in reply to Re: Would you use a switch instead?
in thread Would you use a switch instead?

And, of course, foreach-loop topicalization can also be combined with the original nested ternary expression, although definition and initialization of the variable  $foo are no longer so closely tied together:
>perl -wMstrict -le "my $value = 'bbb'; my $foo; for ($value) { $foo = /aaa/ ? 'wanna' : /bbb/ ? 'be' : /ccc/ ? 'startin' : 'somethin' ; } print $foo; " be

Replies are listed 'Best First'.
Re^3: Would you use a switch instead?
by GrandFather (Saint) on Jul 04, 2009 at 22:32 UTC

    but of course we always use an explicit lexical as a loop variable so there's no gain there is there? ;)


    True laziness is hard work