in reply to Re: Pseudo-switch question
in thread Pseudo-switch question

Oops! Should have checked that code! Curses! Please excuse that poor form; I'm sorry!

Correction

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