Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

||= in Hash Slice

by Brovnik (Hermit)
on Jan 06, 2009 at 11:48 UTC ( [id://734413]=perlquestion: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    my $key_fields    = [ qw( trade_ref sec_code lot of other fields ) ];
    my $copy_fields   = [ qw( item_period other fields) ];
    ...
    # $item is a hashref with some but maybe not all of the
    # above fields defined
    $audit->{$_} = $item->{$_} || '' for @$copy_fields;
    
  2. or download this
    @{$audit}{@$copy_fields} = @{$item}{@$copy_fields};
    $audit->{$_} ||= '' for @$copy_fields;
    
  3. or download this
    @{$audit}{@$copy_fields} = @{$item}{@$copy_fields} || '';
    

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (2)
As of 2024-04-26 00:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found