Note I tend to "clear" an array using:
and not with:@a= ();
undef @a;
The difference is that undef @a will free the memory allocated for the array. If you have put a really huge number of elements into @a and don't plan on doing that again for quite a while, then you probably do want to use undef @a to allow that memory to be reused in the mean time. Otherwise, @a= () is probably a better choice as it removes the overhead of freeing and then later reallocating memory.
Also note that @a= () does free the memory allocated for the elements of the array (except for elements that have other references to them).
- tye (but my friends call me "Tye")In reply to (tye)Re: array initialization
by tye
in thread array initialization
by ashok
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |