Soothing little one liner

nicholas on 2004-11-24T10:03:15

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)


ahhh

jbisbee on 2004-11-24T10:31:56

That was nice... A good tension breaker when things aren't going right at work :)

what's that mean?

avik on 2004-11-24T15:31:31

Useless use of a constant in void context at -e line 1.

Re:what's that mean?

BooK on 2004-11-25T13:16:18

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.

Re:what's that mean?

nicholas on 2004-11-28T18:07:45

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.