0---- 1---- 2---- ... 17---- 18---- 19---- #### #!perl use 5.012; # strict, // use warnings; my $a = 0; while($a < 20) { mySubroutine(); print "----\n"; } sub mySubroutine { print $a++; # implied "return" from subroutine; you could make it explicit on this line if you really wanted to } exit;