in reply to Re^3: In need of a sequence iterator.
in thread In need of a sequence iterator.

Ah ok, well you could use the string approach directly on the packed strings by changing the replace to /chr(ord($1)+1)/e or use a hash to describe successorship in the arbitrary alphabet:

my $alphabet = "0123456789ABCDEF"; my %successor = $alphabet =~ /(.)(?=(.))/g; my $zero = substr($alphabet, 0, 1); ... sub genIterator { my($len, $count) = @_; my $cur = ''; my $lastdig = substr($alphabet, $count - 1, 1); return sub { if (length($cur) < $len) { $cur .= $zero; } else { $cur =~ s/([^$lastdig])$lastdig*\z/$successor{$1}/ or $cur = undef; } $cur; } }

Hugo