Slash Boxes
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

Journal of nicholas (3034)

Wednesday November 24, 2004
05:03 AM

Soothing little one liner

[ #21980 ]

May contain nuts^Wprofanity. You have been warned.

perl -lwe 'print"\r^\n\a"^"\eN\e"^substr$^X,-4while!select$,,$,,$%,.25'

(Also I believe this won't work on Mac OS classic or anything EBCDIC, but it ought to be portable to most other platforms, although you may need to adjust the shell quoting)

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.
  • That was nice... A good tension breaker when things aren't going right at work :)


  • Useless use of a constant in void context at -e line 1.
    • That means you probably pasted it under Windows. You need to change the outer ' to ". And then the inner " to something else using qq. That's what Nicholas meant by you may need to adjust the shell quoting...

      But even with this modification, \n is something else than under Unix, so the xor produces something else. The script prints the rather inocuous string 8uib here.

      • I don't think that your analysis of the cause is correct. The only letter that is correct in your output is the u, which is the only one not generated by an xor with any \ escape sequence. I suspect that actually the Windows shell is doing something with the escape sequences, and if you pasted the script to a file and ran that, it would work. Newline to (carriage return, newline) translation is done at I/O time, not inside the interpreter's data.