in reply to Garbage Collection on Hash delete
From perlfunc:delete
The following (inefficiently) deletes all the values of %HASH: 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]; But both of these are slower than just assigning the empty list or und +efining %HASH or @ARRAY: %HASH = (); # completely empty %HASH undef %HASH; # forget %HASH ever existed @ARRAY = (); # completely empty @ARRAY undef @ARRAY; # forget @ARRAY ever existed
Examine what is said, not who speaks.
The 7th Rule of perl club is -- pearl clubs are easily damaged. Use a diamond club instead.
|
|---|