Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re^3: searching data lines between keywords

by lupey (Monk)
on Jun 14, 2005 at 16:50 UTC ( [id://466633]=note: print w/replies, xml ) Need Help??


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.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://466633]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others cooling their heels in the Monastery: (5)
As of 2024-04-26 08:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found