delete - deletes a value from a hash


delete EXPR


Deletes the specified value from its hash array. Returns the deleted value, or the undefined value if nothing was deleted. Deleting from $ENV{} modifies the environment. Deleting from an array tied to a DBM file deletes the entry from the DBM file. (But deleting from a tie() d hash doesn't necessarily return anything.)

The following deletes all the values of an associative array:

foreach $key (keys %ARRAY) { delete $ARRAY{$key}; }

(But it would be faster to use the undef() command.) Note that the EXPR can be arbitrarily complicated as long as the final operation is a hash key lookup:

delete $ref->[$x][$y]{$key};