in reply to Reference is experimental

Certainly by now you've discovered it, but you have an additional bug:

while (@ARGV){

Since nothing is ever shifted off of @ARGV, the loop will continue almost forever. $counter will increment past the last element in @ARGV, so $filename will start being undef after a few iterations, but you aren't checking the return value of open to ever know that you're failing to open files. Meanwhile you'll keep pushing empty arrayrefs onto @AoA until the system bogs down under the burden of the memory leak.

After fixing that consider also using the 3-arg version of open, and checking for open success.


Dave