Is there another way to use given...when... in a "functional" way which avoids introducing a do statement and a dummy lexical?No, in the same way you cannot do
ormy $r = if ($foo) then {"bar"} else {"baz"};
But you can in ALGOL 68! ;-)my $r = for (1, 2, 3) {$_ + 4};
In reply to Re: functional "given...when..."?
by JavaFan
in thread functional "given...when..."?
by perl5ever
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |