http://www.perlmonks.org?node_id=989364


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.