Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re^2: improve ugly flow control

by Aristotle (Chancellor)
on Sep 20, 2004 at 09:50 UTC ( #392314=note: print w/ replies, xml ) Need Help??


in reply to •Re: improve ugly flow control
in thread improve ugly flow control

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.


Comment on Re^2: improve ugly flow control
Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://392314]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (5)
As of 2015-08-01 03:12 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (285 votes), past polls