Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
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 taking refuge in the Monastery: (8)
As of 2014-09-17 19:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (98 votes), past polls