in reply to Iterating through string combinations
Be prepared to loop for a very long time.my $num = "000"; { $num =~ s{(^|.)(z*)$}{ my ($left, $right) = ($1, $2); $left =~ tr/0-9a-y/1-9a-z/ or $left = "10"; $right =~ tr/z/0/; $left . $right; }e; print "$num\n"; redo while length $num < 20; }
-- Randal L. Schwartz, Perl hacker
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Re: Iterating through string combinations
by I0 (Priest) on Dec 18, 2001 at 08:47 UTC | |
by merlyn (Sage) on Dec 18, 2001 at 09:18 UTC |