Beefy Boxes and Bandwidth Generously Provided by pair Networks Frank
Just another Perl shrine
 
PerlMonks  

Re: Deleting undef values from a hash

by davido (Archbishop)
on Dec 14, 2003 at 07:47 UTC ( #314619=note: print w/ replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    my %hash = ('First' => 1, 'Second' => undef );
    print "First\n" if exists $hash{'First'};
    ...
    __OUTPUT__
    First
    Second
    
  2. or download this
    while ( my ( $key, $val ) = each %hash ) {
        delete $hash{$key} if not defined $val;
    }
    

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (8)
As of 2014-04-16 05:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    April first is:







    Results (414 votes), past polls