Name
delete
Synopsis
delete $hash{key}
delete @hash
{@keys
}
Description
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
.
Get Perl in a Nutshell now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.