http://www.perlmonks.org?node_id=287751


in reply to Clearing an Array of Array's from memory

Most of the time when I see someone clearing memory that way, they're not taking advantage of use strict and lexical scoping.

Instead of manually "freeing" the array, declare it my within the block of code you need it in. Perl will automatically get rid of it when you don't need it anymore. See also, Lexical scoping like a fox.

----
I wanted to explore how Perl's closures can be manipulated, and ended up creating an object system by accident.
-- Schemer

Note: All code is untested, unless otherwise stated