in reply to In need of a sequence iterator.

This is a pretty straight-forward use of Algorithm::Loops's NestedLoops():

#!/usr/bin/perl -w use strict; use Algorithm::Loops qw( NestedLoops ); sub genIter { my( $len, $base )= @_; return scalar NestedLoops( [ ( [ 0 .. ($base-1) ] ) x $len ], { OnlyWhen => 1 }, ); } my( $len, $base )= ( @ARGV, 4, 3 ); my $iter= genIter( $len, $base ); my @list; while( @list= $iter->() ) { print @list, $/; }

- tye