my $num = 0; for (1..5) { $num++; . . } #### for my $num (1..5) { # You can use $num in the loop, and it gets # increased automatically }