Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: How to empty an array ???

by Albannach (Prior)
on Nov 25, 2005 at 22:31 UTC ( #511764=note: print w/ replies, xml ) Need Help??


in reply to How to empty an array ???

Taking another approach, depending on the requirements of your algorithm you might just confine your @flowers in blocks using my like so:

use strict; my @flowers; { my @flowers = qw(rose daisy buttercup); # arrange your flowers here } print @flowers; # prints nothing as these flowers were never assigned
Mind you, from a readability point of view, re-use of variable names is not generally a good idea in my opinion, as it can be quite confusing to others unless your array is always used for the same purpose (e.g. as working space for some subroutine).

--
I'd like to be able to assign to an luser


Comment on Re: How to empty an array ???
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (10)
As of 2014-07-31 17:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (250 votes), past polls