my %description = ( a => 'a vowel', b => 'a consonant' ); for my $choice (qw/a b c/){ print "$choice is ", $description{$choice} || "not in the alphabet.", "\n"; } #### a is a vowel b is a consonant c is not in the alphabet.