Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: I refuse to explain this

by jynx (Priest)
on Apr 13, 2001 at 00:43 UTC ( #72177=note: print w/ replies, xml ) Need Help??


in reply to I refuse to explain this


i'm probably completely off, but it seems to iterate over $_, slowly changing it as it goes along. The two important parts seem to be:

# this increments $R, which tells us which character we're going to pr +int |`i($z) (?{$R++,$q=6) # it tells us that through this snippet: `p($z)(?{print(chr 120-$R),$R=0,$q=7})
So whenever the substitution matches a `i($z) it'll increment $R, and once that gets incremented enough times the RE will match (at some point before matching `i again) `p($z).

$z seems to just match any number of backticks (and $d is set to 2, although this doesn't need to happen) or any number of characters, and $d is set to zero. $d is important because (if i'm reading this right) when there are only backticks left, $z won't match because of the $d flag. This is what will eventually stop the do{}while loop (i think).

The only thing i'm hazy about (other than the whole thing :-) is %bind. Because of it's use you can't use strict, because i don't see it in the built-ins in camel3. And i'm not sick enough to looptrace far enough to find out what $14 and $17 and whatnot else might actually be to see what it's up to.

On the other hand, since this obfuscation completely breaks the debugger (causing it to drop core on my machine), i can't get more details without trying to a) enter Dominus brain or b) become god. Neither seems really possible at this point.

Kudos and ++, this is a work of art.

jynx

PS feel free to /msg or node me that i'm completely wrong, because i'm guessing i am...


Comment on Re: I refuse to explain this
Download Code
Re: I refuse to explain this
by Dominus (Parson) on Apr 13, 2001 at 02:49 UTC
    Says jynx:
    $z seems to just match any number of backticks (and $d is set to 2, although this doesn't need to happen) or any number of characters...
    Not exactly---$z will not match ` or `` or ``` or ```````. And it will match `xy, but not `x`y.

    The i and p substitutions are important for printing, but in the grand scheme of things they're relatively unimportant. The B, C, and S items are much more important.

    There's nothing special about %bind; it's just a regular hash. Feel free to declare it with my %bind at the top of the program. Running this under strict causes Perl to panic though; I don't know why.

    $13 and $14 correspond to the parts of $_ matched by the ($z) expressions in the ``A($z)($z) part of the pattern; similarly $17 is the $z part from `E($z).

    The really tricky part is that although it's i that sets up the $R variable for printed (as you correctly observed) there are only a few i's in $_---not nearly enough to do the job. Or so it would seem. As I said, that's the tricky part.

    Well, thanks for the kind words. :)

Re: Re: I refuse to explain this
by petral (Curate) on Apr 13, 2001 at 19:47 UTC
    $z matches 1 more \w than ': eg, >B< or >``Es`KI`B<, etc. Except for those ```S's, this generally results in a slightly shorter (different) line. Changing the 'p' handling to:
    |`i($z) (?{$R++,$q=6})|`p($z) (?{$X=$R;$R=0;$q=7}) . . . :($15, (chr 120-$X), $bind{$17}, "")[$q-6];
    will let you print (selectively) at the bottom of the loop. (or get ready to do a lot of speed-reading:) eg,      ++$xx; $q==7 and print "$xx: (", length(), ') ', substr $_,0,80;

    update: Oh yes, somes stats from the output:
    5801 substitutions longest line: 1095 chars (after 29 substitutions) first letter at: 456th sub (length 943) first word: 456 to 525 second word: 1314 to 1888 third word: 2813 to 3116 last word: 4125 to 4705 (length 71!)

    p

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://72177]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (4)
As of 2014-12-29 03:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (184 votes), past polls