If you are using lexical variables with narrow scopes, @array might just fall out of scope and be garbage collected without you undeffing it. However, if you really do need to wipe it out and allow its memory to be reclaimed by Perl, undef @array or @array = () will suffice.
But maybe tell us this: what are you trying to do? It's unusual to really have to think about Perl's garbage collection, unless you're worried about reference counts or something. But for the most part, if you're designing your scoping well, there's not usually a need to worry about clearing variables.
A little more detail on what you're dealing with and trying to accomplish might enable us to help steer you toward a solution where you don't need to micromanage the garbage collection.
Dave
In reply to Re: Garbage Collection and undef
by davido
in thread Garbage Collection and undef
by Irinotecan
For: | Use: | ||
& | & | ||
< | < | ||
> | > | ||
[ | [ | ||
] | ] |