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.
In reply to Re: Alphabetical values
by moritz
in thread Alphabetical values
by perlish
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |