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

Re^3: map a hash with a default value or exclude

by PrakashK (Pilgrim)
on Sep 13, 2011 at 19:09 UTC ( #925757=note: print w/ replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    %{$self->{info}} = map {@$_} grep {$_->[1]} map {chomp; [split '=', $_
    +, 2];} <$fh>;
    
  2. or download this
    %{$self->{info}} = map {chomp; my ($k, $v) = split '=', $_, 2; $v ? ($
    +k => $v) : (); } <$fh>;
    
  3. or download this
    # assuming default values are in %defaults
    %{$self->{info}} = map {chomp; my ($k, $v) = split '=', $_, 2; $k => $
    +v || $defaults{$k}; } <$fh>;
    

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (5)
As of 2014-08-22 00:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (145 votes), past polls