Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
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 lurking in the Monastery: (18)
As of 2015-07-28 14:45 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 (256 votes), past polls