in reply to Conditional style (if, &&) query

Way late on the post again, jeffa comes in with TIMTOWTDI (and places vote on style 'B' as long as more choices won't be added).

Consider this nasty block:

my $arg = shift; if ($arg eq 'one') { do_stuff() } elsif ($arg eq 'two') { do_other_stuff() } elsif ($arg eq 'three') { do_even_more_other_stuff() } else { do_yet_even_more_other_stuff() }
To this, much nicer block:
my $arg = shift || 'DEFAULT'; my %lookup = ( one => \&do_stuff, two => \&do_other_stuff, three => \&do_even_more_other_stuff, DEFAULT => \&do_yet_even_more_other_stuff, ); $lookup{$arg}->();
Who even needs if? :D (um, sarcasm)

jeffa