in reply to numerology experiment

I say, "when in doubt, map stuff." I used a hash to map letters to values... I also go 81 as an answer. You could also create your two arrays (wanted and values) and then make them into a hash before running this code:
use strict; my $str = "aabceezazerrfde"; my %values = ('a' => 7, 'e' => 2, 'z' => 26); my $total = 0; foreach(split '',$str){ if($values{$_}){ $total += $values{$_}; } } print "Total: $total";