Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re^4: Secret Perl Operators: the boolean list squash operator, x!!

by Aristotle (Chancellor)
on Aug 02, 2006 at 15:46 UTC ( [id://565250]=note: print w/replies, xml ) Need Help??


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.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (8)
As of 2024-03-28 11:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found