in reply to the if statement

You mean like this?
my %hash = (one => 'uno', two => 'dos', three => 'tres'); my $input = <STDIN>; chomp $input; if (my $ans = $hash{$input}) { print "$input => $ans\n"; }

Note that I've declared all the variables with my because I have strict (and warnings) enabled.


Unless I state otherwise, all my code runs with strict and warnings