in reply to Re^3: Find duplicate digits
in thread Find duplicate digits

perldoc perlrun
$ perl -MO=Deparse -le"%h=(), undef @h{split'',$_}, keys %h == 3 and + print for '0000'..'9999'" BEGIN { $/ = "\n"; $\ = "\n"; } ; (%h) = (), undef @h{split(//, $_, 0)}, keys %h == 3 and print $_ forea +ch ('0000' .. '9999'); -e syntax OK
$ indicates a command prompt (a shell, like bash/csh/cmd...)

Replies are listed 'Best First'.
Re^5: Find duplicate digits
by mroman (Initiate) on Apr 07, 2010 at 14:07 UTC
    Anonymous Monk,

    Thank you for this. I did as you kindly suggested and here is what happened:

    mrh@workstationmachine:~$ BEGIN { $/ = "\n"; $\ = "\n"; } bash: syntax error near unexpected token `}' mrh@workstationmachine:~$ ; bash: syntax error near unexpected token `;' mrh@workstationmachine:~$ (%h) = (), undef @h{split(//, $_, 0)}, keys +%h == 3 and print $_ forea bash: syntax error near unexpected token `=' mrh@workstationmachine:~$ +ch ('0000' .. '9999'); bash: syntax error near unexpected token `'0000'' mrh@workstationmachine:~$ -e syntax OK bash: -e: command not found
    ?