Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: Re: Deleting undef values from a hash

by liz (Monsignor)
on Dec 15, 2003 at 09:46 UTC ( #314787=note: print w/ replies, xml ) Need Help??


in reply to Re: Deleting undef values from a hash
in thread Deleting undef values from a hash

Rafael applied my documentation patch yesterday:

-Returns each element so deleted or the undefined value if there was n +o such -element. Deleting from C<$ENV{}> modifies the environment. Deleting + from +Returns a list with the same number of elements as the number of elem +ents +for which deletion was B<attempted>. Each element of that list consi +sts of +either the value of the element deleted, or the undefined value. In +scalar +context, this means that you get the value of the last element delete +d (or +the undefined value if that element did not exist). + + %HASH = (foo => 11, bar => 22, baz => 33); + $scalar = delete $HASH{foo}; # $scalar is 11 + $scalar = delete @HASH{qw(foo bar)}; # $scalar is 22 + @array = delete @HASH{qw(foo bar baz)} # @array is (undef,undef +,33) + +Deleting from C<$ENV{}> modifies the environment. Deleting from a hash tied to a DBM file deletes the entry from the DBM file. Delet +ing from a C<tie>d hash or array may not necessarily return anything.

Liz


Comment on Re: Re: Deleting undef values from a hash
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (5)
As of 2015-07-04 20:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (60 votes), past polls