Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
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?
[beech]: nobliest nodes
[Discipulus]: ah no newest nodes! ask something
[beech]: why is my butt itchy
Discipulus many countries without bidet.. is a big problem!
[beech]: who told you i call my butt france?

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (6)
As of 2016-12-09 09:44 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    On a regular basis, I'm most likely to spy upon:













    Results (150 votes). Check out past polls.