3.2.26 delete
delete
This function deletes the specified key and associated value from the specified hash.
(It doesn't delete a file. See
unlink
for that.)
Deleting from
The following naïve example inefficiently deletes all the values of a hash: foreach $key (keys %HASH) { delete $HASH{$key}; }
(It would be faster to use the
undef
command on the whole hash.)
delete $ref->[$x][$y]{$key}; For normal hashes, the delete function happens to return 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 . |
|