in reply to Alphabetical values

Use a hash:
my %freq = ( a => 123, b => 200, c => 700, ... z => 800, ); my $sum = 0; for (split //, $word) { $sum += $freq{$_}; } print "Sum: $sum\n";

Note that the lookup is case sensitive, so may you need lc or uc to fix that.

See perlintro and perldata.