#! /usr/bin/perl use strict; # Demonstration of how much various things are worth... # A=1, B=2, C=3... my %chr2val; my $chr_value = 1; for ('A'..'Z') { $chr2val{lc($_)} = $chr2val{$_} = $chr_value++; } my $value = 0; # Illustrative examples if people haven't entered their own. @ARGV = ("HARD WORK", "KNOWLEDGE", "ATTITUDE", "BULLSHIT") unless @ARGV; foreach my $word (@ARGV) { my $value = 0; foreach my $char ($word =~ /\w/g) { $value += $chr2val{$char}; } print "The value of '$word' is $value%.\n"; }