in reply to Re^2: searching data lines between keywords
in thread searching data lines between keywords

@{$hash{$currentkey}} is an array so you can truncate the array just as you would any other array. You don't need to use push. Both of these will do the trick

@{$hash{$currentkey}} = (); $#{$hash{$currentkey}} = -1;

Lupey

Replies are listed 'Best First'.
Re^4: searching data lines between keywords
by kaif (Friar) on Jun 14, 2005 at 16:57 UTC

    I would like to create the array if it doesn't exist and not do anything otherwise. This is similar to the touch command in Unix-like environments. The command push @{$ref}; does exactly that: it pushes nothing onto the array, which creates it if necessary but doesn't change it if it exists.