use strict; use warnings; testFunc(); { my $i = 0; sub testFunc { $i++; print "$i\n"; testFunc() if($i <10); } }