I liked that quite a bit, but the structure has been bothering me, like with most other solutions: it feels to me like the failure case gets too much emphasis. I didn't know how to do any better when I first saw the post, though. But now I think I do:
{ my $try = first { $hash{ $_ } } @options; defined $try or ( log_failure(), last ); do_something( $try ); }
Makeshifts last the longest.
In reply to Re^2: improve ugly flow control
by Aristotle
in thread improve ugly flow control
by perrin
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |