use HugeObject; my $result = 0; { my $object = HugeObject->new(); $result = $object->get_even_bigger(); $object = undef; } # Phew, should free up memory now. if ($result) { # code here }