in reply to Default Hash Key
Just in case you have an 'XY' problem in your question, here's a common solution for this class of thing:
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"; }
Output:
a is a vowel b is a consonant c is not in the alphabet.
-- Human history becomes more and more a race between education and catastrophe. -- HG Wells
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Default Hash Key
by tford (Beadle) on May 02, 2008 at 04:32 UTC | |
by mrons (Beadle) on May 02, 2008 at 05:21 UTC | |
by EvanCarroll (Chaplain) on May 02, 2008 at 14:51 UTC | |
by matze (Friar) on May 03, 2008 at 12:58 UTC | |
by Anonymous Monk on May 04, 2008 at 17:10 UTC | |
by roboticus (Chancellor) on May 02, 2008 at 10:42 UTC |
In Section
Seekers of Perl Wisdom