in reply to Re^2: searching data lines between keywords
in thread searching data lines between keywords
P.P.S.: Can some enlightened monk tell me the preferred way to "touch" an array (reference). That is, if I only want to clear an array if it doesn't already exist (see my @{$hash{$currentkey}} = (); addition above). The snippet push @{$hash{$currentkey}}; works but produces a Useless use of push with no values warning.
I typically use:
$hash{$currentkey} ||= [];Which will set it to an empty array ref, if it isn't already a 'true' value, and undefined isn't true ... of course, there's lots of other not true values, as well (empty string, 0, etc.)
|
|---|