I'm not big on writing japhs; in fact, until tonight, I've never written one that I would actually consider for a .signature or something... but something about the discussion at Dangerous diamonds! inspired me and I cranked out two that I like. I didn't see any based on the same principle in the collection of miscellaneous japhs at http://www.cpan.org/misc/japh so I'm hoping they are original. (Let me know if they aren't.)

Which do you like better?

First, the slightly more obfu'd one:

perl -e "s();echo Just another Perl hacker,|;;open _;print<_>"
And the basic one:
perl -pe "BEGIN{@ARGV='echo Just another Perl hacker,|'}"

Addendum: Gee, just minutes later and at -2? I'm not complaining, mind you... but I'd like to know why. Are they not original despite my thinking they might be? Just for the record, these are not dangerous despite where I got my inspiration. *sigh*

Update: Changed quoting to make them work on Windows too.

-sauoq
"My two cents aren't worth a dime.";

Replies are listed 'Best First'.
Re: My First Good(?) Original(?) JaPh,s
by arthas (Hermit) on May 22, 2003 at 14:24 UTC
    I like it, expecially the first version. It's not so hard to figure out the s// masked as a function call, but it's really nice anyway. The non-obfuscated version:
    perl -e "s//echo Just another Perl hacker,|/; open _; print<_>;";
    ;-)

    Michele.
Re: My First Good(?) Original(?) JaPh,s
by Aristotle (Chancellor) on May 23, 2003 at 23:38 UTC
    I think it would benefit greatly from obscuring the purpose of the echo more. Since you're already assuming echo is there, you might as well get some more milage out of it.
    echo echo | \ perl -n'i|' -n'es$^$\$^I$se;s((??{"\044"}));" Just another Perl hacker +";e;open _;'

    Makeshifts last the longest.

      To avoid relying on the presence of echo...

      perl -pe "BEGIN{@ARGV='perl -le print+q~Just\ another\ Perl\ Hacker,~| +'}"

      Yours is nicely obfuscated, but I guess that's not really what I was going for. I like those japhs that you look at and think, "huh?" because they are almost obvious but not quite. I especially like the ones that highlight a peculiarity or two of perl's. Ones that look too messy, usually discourage closer inspection, at least for me. Things like s((??{"\044"}));"...";e; increase the tedium factor but that's about it.

      On the other hand, I liked your use of $^I and I really should have placed the pipe first and just used open too... good catch. How about:

      perl -i'|echo\040Just\040another\040Perl\040hacker,' -e's//qq("$^I")/e +e;open _;'

      -sauoq
      "My two cents aren't worth a dime.";
      

        Doesn't seem obfuscated enough to me. Regardless even of the /ee it's pretty obvious what's going on.

        I think it's important to hide the pipe for this one, otherwise while the details are not immediately obvious, the mechanics remain apparent. That's why I chose such an unusual placement of the shell quotes. The caret and dollar used to edit the incoming line also give away a lot. And don't forget that the one who started with pure tedium measures was you. :) (Remember s();..;;)

        Obfuscations that rely purely on one or two arcane features don't work very well as far as I'm concerned. The trick is to hide your use of that arcane feature, and if possible even mislead the reader into thinking that something else entirely is going on. The best example I've ever seen is from Abigail: Things are not what they seem like.

        As an aside, the best obfu I've ever seen is also from him:

        A Japh that uses...
        • Computed goto.
        • eval
        • POD.
        • A loop with only unconditional jumps....
        • ... but it terminates anyway.
        • Self modifying code.
        • strict
        • -w
        • No more than one line.
        • No more than 80 characters.
        perl -Mstrict -we '$_ = "goto F.print chop;\n=rekcaH lreP rehtona tsuJ +";F1:eval'
        (From his Japhs talk.)

        Makeshifts last the longest.