Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

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

by ikegami (Pope)
on Sep 20, 2005 at 16:24 UTC ( #493502=note: print w/ replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    {
       local $_ = $b;
       $a->{b} = $_ if defined $_;
    }
    
  2. or download this
    foreach ($b) { $a->{b} = $_ if defined $_; }
    
  3. or download this
    $a->{b} = $_ foreach grep defined, $b;
    
  4. or download this
    delete @$a{ grep { not defined $a->{$_} } keys %$a };
    

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (9)
As of 2014-10-02 12:33 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    What is your favourite meta-syntactic variable name?














    Results (56 votes), past polls