my $i; for $i ( 1..$some_max ){ #do something } # and later for $i ( 1..$some_other_max ){ #do something else }