in reply to Helping the garbage collector

    $data[$i] = ();

In that line, you assign an empty list to $data[$i], which is a scalar. The empty list has to be "converted" to undef, so I guess that takes a little time. With this solution, all values are deleted, but they still exist. If that's what you want, for example if you want to re-fill the array, use: $_ = undef for @data; If you want to clear the entire array, use: @data = (); What you probably meant to use is:

for (@data) { @$_ = (); }
hth

U28geW91IGNhbiBhbGwgcm90MTMgY
W5kIHBhY2soKS4gQnV0IGRvIHlvdS
ByZWNvZ25pc2UgQmFzZTY0IHdoZW4
geW91IHNlZSBpdD8gIC0tIEp1ZXJk

Edit by dws for tag cleanup