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


in reply to Re^3: Secret Perl Operators: the boolean list squash operator, x!!
in thread Secret Perl Operators: the boolean list squash operator, x!!

Sorry, but I find that 10× less readable than doing the work in place would be. In a realistic codebase, these pieces would be far apart, and making sure you understand exactly what is going on would require crossreferencing. Dependencies should not be introduced without cause, as they always carry a cost. Your suggestion is just an overmodularised version of this:

my $uri = join '/', 'http://example.net/app', grep { defined } ( ( $is_admin ? 'admin' : undef ), $subsite, $node, $id, $subnode, );

That is basically tye’s suggestion. And it’s a fine suggestion if you can resolve the irregularities enough to do it this way. But it doesn’t cover all cases that x!! can – see my other example where grep is clearly inappropriate.

Makeshifts last the longest.