use strict; use warnings; sub test { print ++$i,"\n"; } sub function { my $i = 0; test(); test(); }