Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

New Obfuscation Trick!

by japhy (Canon)
on Nov 26, 2002 at 16:35 UTC ( #215863=obfuscated: print w/ replies, xml ) Need Help??

As discovered by Nicholas Clark:
$J=q$JAPH$;print"${"; J}s rule

_____________________________________________________
Jeff[japhy]Pinyan: Perl, regex, and perl hacker, who'd like a job (NYC-area)
s++=END;++y(;-P)}y js++=;shajsj<++y(p-q)}?print:??;

Comment on New Obfuscation Trick!
Download Code
Re: New Obfuscation Trick!
by dingus (Friar) on Nov 26, 2002 at 17:28 UTC
    Doesn't work for me as is. Are you sure you don't mean
    $J=q$JAPH$;print"${J}s rule";
    ?

    Dingus


    Enter any 47-digit prime number to continue.
      It does work for me, in both forms:
      perl -le ' J}s rule' JAPHs rule perl -le ' $J=q$JAPH$;print"${J}s rule"; ' JAPHs rule
      But I don't understand the first version. Why does it work? perl 5.8.0 on linux, btw.

      -- Dan

        Something to do with the lexer I believe, or so I've read.
        HTH

        _________
        broquaint

      Ok I see why I thought it didn't work. I habitually test fragments like this in an eval statement because I have my own home rolled "Interpreted Perl Console"©. In the interpreted console it fails. If I make a trivial perl script it works.

      Can anyone explain why it doesn't work in an eval and does work as a program?

      #!perl #this script doesn't work my $t = <<'EOT' ; $J=q$JAPH$;print"${"; J}s rule EOT print "$t\nResult:\n"; eval $t; ------------------------------ #!perl #this script works $J=q$JAPH$;print"${"; J}s rule

      Dingus


      Enter any 47-digit prime number to continue.
Re: New Obfuscation Trick!
by Felonious (Chaplain) on Nov 27, 2002 at 04:59 UTC
    ++japhy:) Interesting how code can be mixed in with it as well...

    sub a_naked { print 'Just another' } print qq|${ print "I gotta be...\n";| a_naked} Perl hacker

    The early worm gets the bird.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (8)
As of 2014-08-21 21:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (143 votes), past polls