Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: improve ugly flow control

by Zaxo (Archbishop)
on Sep 19, 2004 at 07:41 UTC ( #392132=note: print w/ replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    log_failure()
        unless grep {
            exists($hash{$_})
            && do_something($_)
            .. 1
        } @options;
    
  2. or download this
    grep {
        exists($hash{$_})
        && do_something($_)
        .. 1
    } @options or log_failure();
    
  3. or download this
    $ perl -Mstrict -we'my $s=1;for(qw/foo bar baz/){ print if /b/..$s }'
    barbaz$ 
    $ perl -Mstrict -we'my $s=1;for(qw/foo bar baz/){ print if $s../b/ }'
    $ 
    
  4. or download this
    $ perl -e'for (qw/foo bar baz blah/){print int scalar(/b/..//)}'
    0111$ 
    
  5. or download this
    {
        my $success;
        grep {
    ...
        } @options
            or log_failure();
    }
    

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (5)
As of 2014-10-24 21:33 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (137 votes), past polls