Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
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 surveying the Monastery: (4)
As of 2014-12-21 01:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (101 votes), past polls