in reply to convert letters into a number

You could just make a hash of the letters with the keys the letters and the values the numbers.
Then it would be simply a case of splitting up the string into characters and going through them and if it's a letter it looks it up in the hash.

This is just an example, but it works...:

$string = "AFP254"; $number = 1; foreach('A'..'Z'){ $alpha_nums{$_} = $number; $number++; } + @string = split("", $string); $total = 0; foreach(@string){ if(/\S/ && !/\d/){ $_ = $alpha_nums{$_}; } $total = $_+$total; } print "$total\n";