Original Enough?
perldeveloper
created: 2004-07-01 07:55:33
@ARGV=$0; $GR=@AV+$=;$_=<>;s/([^+]+)\+.+/y|$+$GR++|morenlpsk|/;eval;s/[^k]+?kk(.+)kk.+/$+/;print;

Update: Prints `perlmonks'. Runs only from its own file, code starting on first line with no extra leading spaces, obviously no #!/usr/.../perl on the first line.

What it does
Transliterates the perl code itself onto the perlmonks string. Reuses an anagram of the same characters (@ARGV=$0; to $GR=@AV..) to generate more perl code and transforms it into a y||| transliteration by using an s/// search. Also uses the fact that unmapped transliteration characters are mapped to the last of the mapped-to characters. Obfuscates the character 0 (zero) by using the $= variable whose value is usually 60 by default (`6' will map to the last transliteration character, `k', while `0' will map to `s').

I see another monk, jdalbec, has taken the time to rearrange the code in a reply.
Re: Original Enough?
created: 2004-07-01 23:31:59

Use tags to prevent line breaking at spaces.

I've broken up the statements into separate lines where possible. You may want to uncomment the extra print statements I've added and run the modified program to get a better view of what's going on. Highlight the black table to view the code.

@ARGV=$0; $GR=@AV+$=; # everything up to the + sign must be unchanged
$_=<>; # read first (only) line of file
s/([^+]+)\+.+/y|$+$GR++|morenlpsk|/; # replace entire line w/ translate
# print;
eval; # self-modifying code!
# print;
s/[^k]+?kk(.+)kk.+/$+/; # get rid of everything but the magic word(s)
print$_;
Re: Original Enough?
created: 2004-07-08 17:35:29
this is real cool. the thing i don't understand is, why $_=<> is reading the first line, not from STDIN. could you please give me a hint about this? thanks alot.
Re^2: Original Enough?
created: 2004-07-10 07:08:05
The diamond operator <> attempts to read from the file denoted by the elements in @ARGV (it tries reading from $ARGV[0] and increases the index in case opening the file denoted by the previous index fails).

An assignment of the form @ARGV=$0 is the same as @ARGV=($0), which actually means $ARGV[0]=$0. Since $0 is the filepath of the perl script itself, the diamond operator will read the first line from the perl script file.

The diamond operator will read from STDIN only if the @ARGV list is empty.

perlmonks.org content © perlmonks.org and Anonymous Monk, jdalbec, perldeveloper

prlmnks.org © 2006 edmund von der burg (eccles & toad)

v 0.03