I'm completely stumped on how to accomplish my task programmatically.
I have a dynamically changing alpha string variable named $string. I have corresponding values set to each letter in the alphabet. I need to be able to automatically calculate the value of $total_string_length based on the letters within the $string variable.
$string = "jack"
$A_length = 1000;
$B_length = 500;
$C_length = 200;
$D_length = 1000;
$E_length = 1400;
$F_length = 100;
$G_length = 5000;
$H_length = 2000;
$I_length = 600;
$J_length = 8000;
$K_length = 8000;
etc...
$total_string_length = $J_length + $A_length + $C_length + $K_length
How do I easily substitute the corresponding alpha letter variable values to find the $total_string_length ?
Any help is much appreciated.