sub generateSequencer { my( $start, $inc )= @_; $start -= $inc; return sub { return $start += $inc; }; } my $countByTwos= generateSequencer( 0, 2 ); print $countByTwos->(), $/ for 1..3; my $countByThrees= generateSequencer( 1, 3 ); print $countByTwos->(), " ", $countByThrees->(), $/ for 1..4; #### 0 2 4 6 1 8 4 10 7 12 10 #### sub { return $start += $inc; }; #### print $countByTwos->(), " ", $countByThrees->(), $/