Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much

Re^2: Shortcut operator for $a->{'b'}=$b if $b;

by radiantmatrix (Parson)
on Sep 20, 2005 at 17:35 UTC ( #493541=note: print w/ replies, xml ) Need Help??

in reply to Re: Shortcut operator for $a->{'b'}=$b if $b;
in thread Shortcut operator for $a->{'b'}=$b if $b;

A little less ugly audit:

for (keys %$a) { delete $a->{$_} unless $a->{$_} }

Note: that should probably be unless defined $a->{$_} so we don't remove false keys, but I made the choice to mirror the OP's syntax.

Larry Wall is Yoda: there is no try{} (ok, except in Perl6; way to ruin a joke, Larry! ;P)
The Code that can be seen is not the true Code
"In any sufficiently large group of people, most are idiots" - Kaa's Law

Comment on Re^2: Shortcut operator for $a->{'b'}=$b if $b;
Download Code

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (14)
As of 2015-11-25 18:38 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (684 votes), past polls