leaves the length of the array alone (so scalar(@array) and $#array are unchanged) but blows away all the contents, including any string buffers they might have used.for ($i = 0; $i<=$#array; ++$i) { undef $array[$i]; }
also leaves the length of the array alone (so scalar(@array) and $#array are unchanged) but undefines all the contents. However, if $array[42] was "what is the meaning of life", $array[42] will still have a 28+ byte area reserved for a string so assigning $array[42]="python's flying circus" will not require perl to allocate any new memory.for ($i = 0; $i<=$#array; ++$i) { $array[$i] = undef; }
In reply to Re: How do I completely empty out an array?
by ysth
in thread How do I completely empty out an array?
by vroom
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |