use strict; use warnings; my $c = 0; sub foo { print "$c\n"; $c++; my $mem = 'x' x 1000000; foo(); } foo();