Perl in a Nutshell

Perl in a NutshellSearch this book
Previous: Reference: definedChapter 5
Function Reference
Next: Reference: die
 

delete

delete $hash{key}
delete @hash{@keys}

Deletes the specified key or keys and associated values from the specified hash. (It doesn't delete a file. See unlink for that.) Deleting from $ENV{} modifies the environment. Deleting from a hash that is bound to a (writable) DBM file deletes the entry from the DBM file.

For normal hashes, the delete function returns the value (not the key) that was deleted, but this behavior is not guaranteed for tied hashes, such as those bound to DBM files. To test whether a hash element has been deleted, use exists.


Previous: Reference: definedPerl in a NutshellNext: Reference: die
Reference: definedBook IndexReference: die

Library Navigation Links

Copyright © 2001 O'Reilly & Associates. All rights reserved.