That's rather old news. You have just generated a cyclic reference: the variable references the closure and the closure references the variable. Perl cannot garbage collect such data structures because it uses a simple reference counter to keep track of referenced memory; in the case of cyclic structures all members reference each other, so the counter never reaches zero even if there aren't any references pointing to the structure from the outside.