Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change

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.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://989364]
[stevieb]: In msg, how do I message someone with a space in their name. For example, I want to privately message "Your Mother", but am unsure of how to do so. Link/tips?
[pryrt]: In the link brackets...
[stevieb]: guys, not *your* mother, "Your Mother" here on PM. Sheesh. Like I haven't spoken to your mom
[stevieb]: pryrt the brackets work in such a thing? I have nobody to test against. I will try :)

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (6)
As of 2018-03-23 00:38 GMT
Find Nodes?
    Voting Booth?
    When I think of a mole I think of:

    Results (287 votes). Check out past polls.