in reply to How to empty an array ???

I agree with Albannach: you should learn about variable scopes.

In perl, there typically never is a need to empty an array. If you limit the scope of your array to the loop block, you'll simply get a new empty array every time through the loop. Simple, effective, and very generically appliable.

for (1 .. 3) { my @flowers; # new, emtpy array, every time ... }

Replies are listed 'Best First'.
Re^2: How to empty an array ???
by Joost (Canon) on Nov 26, 2005 at 04:03 UTC
    In perl, there typically never is a need to empty an array.
    Except, when you're running low on memory. Explicitly using an undef @flowers might help you in that case even if the array goes out of scope and most of its memory would get reclaimed anyway.

    But usually, using the right scope for variable declaration is enough.