Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re^3: if,if and again,if

by moritz (Cardinal)
on Aug 23, 2012 at 18:04 UTC ( #989364=note: print w/ replies, xml ) Need Help??


in reply to Re^2: if,if and again,if
in thread if,if and again,if

If we go all perlish, I'd get rid of the ugly map with a ternary :-). Either

my $category = first { ... } ... ; if ($category) { $category = $category->[1]; print "[INFO] Category: $category\n"; }

Or if you insist on a map on a one-element list, write it as

map $_->[1], grep $_, first { .... } ...;

IMHO several simple operations are easier to read than a few complicated ones.


Comment on Re^3: if,if and again,if
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (6)
As of 2016-02-13 23:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How many photographs, souvenirs, artworks, trophies or other decorative objects are displayed in your home?





    Results (449 votes), past polls