getPhoneNumbers(7); sub getPhoneNumbers { my $maxLength = shift; my $curPhoneNumber = shift || '0'; if($maxLength - 1) { for(my $i = 0; $i < 10; $i++) { getPhoneNumbers($maxLength - 1, $curPhoneNumber.$i); } } else { print $curPhoneNumber, "\n"; } }
In reply to Re: Telephone - Nested Loops
by ozone
in thread Telephone - Nested Loops
by FFRANK
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |