in reply to Alphabetical values
And of course, you don't have to split the string into a list:
my $sum = 0; while ( $word =~ /(.)/g ) { $sum += $freq{ $1 }; } print "Sum: $sum\n"; [download]