my %scores = ( map { $_ => 1 } qw( A E I L N O R S T U ), map { $_ => 2 } qw( B D G ), map { $_ => 3 } qw( C M P ), map { $_ => 4 } qw( F H V W Y ), map { $_ => 5 } qw( K ), map { $_ => 8 } qw( J X ), map { $_ => 10 } qw( Q Z ), ); print("Find the Scrabble value of a word.$/$/"); for (;;) { print("Enter a word (or just Enter to quit): "); local $_ = ; last unless defined; chomp; last unless length; $_ = uc($_); my $sum = 0; $sum += $scores{$1} while (/([A-Z])/g); print("Scrabble value: $sum$/$/"); }