Does the following code do what you need? It's basically what BrowserUk recommended, but lc is better than uc. (... because I said so!... and, besides, I wrote it before I saw BrowserUk's message! :)) ...
use strict;
use warnings;
my %known = (
"foo" => "FOO",
"bar" => "BAR",
"baz" => "BAZ",
);
while ( <STDIN> ) {
chomp;
my $input = $_;
for ( keys %known ) {
if ( lc($input) eq $_ ) {
print "You gave us $input, which equates to " . $known{lc(
+$input)};
print ". Have a nice day\n";
}
}
}
--
-- Ghodmode
Blessed is he who has found his work; let him ask no other blessedness.
-- Thomas Carlyle