my $a = []; $a->[$_] = $_ for 0..999; $#$a = 1; # frees up approx 16000 bytes undef @$a; # frees a further 4000 bytes undef $a; # frees a further 52 bytes