my($favorite_color) = ''; # get some kind of input here
print {
'red' => sub { 'the color is red.' }
'yellow' => sub { 'the color is yellow.' }
'blue' => sub { 'the color is blue.' }
'null' => sub { 'I do not know that color' }
}
->{ $favorite_color || 'null' }
-- Tommy Butler, a.k.a. TOMMY
In reply to Re: Pseudo-switch question
by Tommy
in thread Pseudo-switch question
by fletcher_the_dog
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |