in reply to Re^7: in search of a more elegant if then else
in thread in search of a more elegant if then else
I have a vague preference for the last one, but only because it's most like how I'd actually write it:
or maybe slightly clearer would be:my @filtered = do for $s.comb -> $a, $b { [ $a, $b ] if $a ne $b; }
But mathematicians are likely to prefer the list comprehension syntax, I suspect.my @filtered = gather for $s.comb -> $a, $b { take [ $a, $b ] if $a ne $b; }
In Section
Seekers of Perl Wisdom