Smells like a homework assignment but here's a solution without any dependencies:
#!/usr/bin/perl use strict; use warnings; PIN: foreach my $pin ("0000" .. "9999") { # Last digit is a 1 next unless $pin =~ /1$/; # No repeating digits my %count = (); foreach my $digit (split(//, $pin)) { $count{$digit}++; next PIN if $count{$digit} > 1; } print $pin . "\n"; }
I got 99 problems, most of them have to do with printers.
In reply to Re: Pin code
by FloydATC
in thread Pin code
by Starz
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |