Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
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 scrutinizing the Monastery: (9)
As of 2014-10-22 22:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (122 votes), past polls