Perl Home
PERL Functions
© 2011 TutorialsPoint.COM
|
PERL delete Function
Syntax
Definition and Usage
Deletes the specified keys and associated values from a hash, or the specified elements
from an array. The operation works on individual elements or slices.
Return Value
Example
The following (inefficiently) deletes all the values of %HASH and @ARRAY:
foreach $key (keys %HASH) {
delete $HASH{$key};
}
|
foreach $index (0 .. $#ARRAY) {
delete $ARRAY[$index];
}
|
And so do these:
delete @HASH{keys %HASH};
|
delete @ARRAY[0 .. $#ARRAY];
|
|

|
|
|