in reply to Re^3: Find duplicate digits
in thread Find duplicate digits
The solution I posted is a one-line perl command, to be run from a command shell prompt, not to be embedded within a perl source file.
If you're running under *nix, then you'll have to exchange the quotes like so:
perl -le'%h=(), undef @h{split"",$_}, keys %h == 3 and print for "0000 +".."9999"'
The following will run as a script:
#!/usr/bin/perl -lw use strict; for ( '0000'..'9999' ) { my %h; undef @h{split'',$_}; keys %h == 3 and print; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^5: Find duplicate digits
by mroman (Initiate) on Apr 07, 2010 at 14:15 UTC |