Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask

Obfuscated code

( #1597=superdoc: print w/ replies, xml ) Need Help??

Got some code which would take a Perl grand master to understand without running it? Post it in this section so we can stare at it in awe.

Word of warning, though: Don't be too cocky with your post — almost inevitably someone will post a reply that does the exact same thing in even fewer characters!

New Less than Readable Code
First Japh
2 direct replies — Read more / Contribute
by Discipulus
on Feb 06, 2015 at 07:15
    Not sure if can be considered an obfu..
    unx#perl -e '@_="Js nte elHce rka rPrhoAtu"=~/./g;for$}(1..$#_+1){whil +e(<$0 >){(s|e|($}%2?shift@_:pop@_)|e);print}}' win>perl -e "@_='Js nte elHce rka rPrhoAtu'=~/./g;for$}(1..$#_+1){whil +e(<$0 >){(s|e|($}%2?shift@_:pop@_)|e);print}}"

    There are no rules, there are no thumbs..
    Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.
Late PM, 12/24/2014 & all year long
2 direct replies — Read more / Contribute
by ww
on Dec 24, 2014 at 23:00
    perl -e "srand 42; print sort {4-rand 9} split //, 'ts aroMrhirsae C tll!!ym';"

    Adapted from Re^2: Slightly Srandom JAPH; Update: now known to be highly OS and version specific, but "Season's Greetings" anyway!
    *1 : Alt date format: 20141224. This node, however, is known to be ISO 2000 non-compliant.
    *3Notes placed in sig & then reordered for comppliance with obfuscation.
    *2 : Original OS/vers.: AS 5.018 & Win7.

Code golfing site - SHORTEN
1 direct reply — Read more / Contribute
by kokosek
on Nov 30, 2014 at 21:09

    Hello. I'm the admin of A site, in which you can submit your Perl programs and they will be compiled and run with problem's data.

    I have a user there who is especially good in Perl and he has the best score (= shortest programs) in most problems. So I was thinking that perhaps some of you would like to give it a try and challenge him. I'm wondering whether anybody can beat him in any task.

    Here's a ranking for Perl (as you can also submit on SHORTEN programs in other languages):
    As you can see, his score is 9.93/10.

    To encourage you, printing n-th Fibonacci number takes in Perl only 43 chars (assuming t tests) - it's FIBON problem on SHORTEN if you wondered.

I love eval
No replies — Read more | Post response
by Anonymous Monk
on Nov 27, 2014 at 12:23
    $_='($.=".-3-01/1-5+5*7)7)G*E,C.A0?3;77;3?0A-D+F)8")=~s#.#(($a^=1)?$": +"X" )x(ord($&)-40)#eg;($l=$.)=~s#X#(split//,"ILOVEYOU")[$p++%8]#eg;;;$.=~s +#X# (split//,"\$_=\47$_\47;s/\134s//g;eval")[$q++]#eg;{print("\ec".join$/, +unp ack"(A32)*",(($z^=1)?$.:$l))&sleep(1)&redo}';s/\s//g;eval #TSR +'14

    shape stolen from here

Simple JAPH
1 direct reply — Read more / Contribute
by hookbot
on Aug 09, 2014 at 14:38

    I removed most of the cruft from my first JAPH so it's much cleaner to follow:

    $,=pack H84,D73.D0086e.BF4A25 .C80.C25.Ca.C028863.Ae5c8;sub s{@_?print:f &s((\w)(\w+)(\W) \3*)($1\L$2 )gx}& ##; s if@_=##; s()## & ##; s() ## & & ##; {pack u,$,}e&# s()## & & ##; s() ## & ##;

    You can't shoot yourself in the foot with this one even though the code still looks like a gun. (For security reasons, I won't show the original "James Bond" JAPH since it's too scary.)

1 direct reply — Read more / Contribute
by Grimy
on Jul 14, 2014 at 15:48
    While dusting off my files on an old XP box, I stumbled upon a JAPH I wrote a few years ago, but never shared. After trying to puzzle it out for nearly an hour, I reluctantly broke out perl -d, which gave me the solution—as well as the insight that my former self is a sly bastard. Here is the JAPH:
    @ARGV = ${$-=$.}, s<#<>q#>#q<<>> #exegesis=>print, hacker=>unless $/=q=echo q/Just another Perl /| $/=!~>die
    This code needs to be stored in a file to work. Tested on Strawberry Perl 5.12 (WinXP) and Perl 5.20 (Arch Linux). Strictures and warnings will give some clues.
First JAPH
5 direct replies — Read more / Contribute
by Feland
on Jun 17, 2014 at 10:32

    This is my (oh !!) first JAPH. I'm a little newbie at this place, but I hope that is not too bad :) Please, comment !

    &p(qw(Ju));$x= $/;$|=$$;$,=$/;$\=$!; sub T{eval$_[0]};sub su{T q%sel%.q +ect *a,* a,*+.'a, .06';}sub p{T(q;p;. q 5ri5.q qntq)for @_}map{p ('u');& su;}(1.. 17);sub s{+$_[0] };&s(&su );$a='rl' ;$\=$x;&s(&p("st"));$\=$!;&s (&su);sub r($;){+p($_[0] )};p(q-A-);sub z{$\=$/?$;: $,;$,=$;;su();map{&s(p('a'));& s(su);}@_};z((1..7));$,=$x;$\=$, ;$"=$\;$,=$/; $_=q!!;s;;;; p(q qnoq.q rthe\rr);$\ =$/?$;:$,;$ ,=$;;;;su(); r "P";map{r "e";&s||&su; }(1..42);$\ =$;;&s(p($a) );T(T(su())); r $/;r "H";$\ =$/?$;:$,;$/=$,;z(1..12);$,=$\;$\ =$/;$a=~s/(.)l//;p(q tcket.$1 );&s(p($"));$e='Felicien'; #MYFIRSTJAPH
use warnings qw( japh );
3 direct replies — Read more / Contribute
by tobyink
on Jun 06, 2014 at 18:33
    use strict; use warnings; use overload; my %D; sub quux { +undef }; su +b quuuux { goto \&overload::constant } sub quuux { my $x = close STDIN; +# overload::constant J => sub { 1 }; print quux; *quux = sub { "Hello" } +; $x="William".tell STDIN and select($x+=1,undef,undef,0.1);%D=(q=>quux( +) ,$x);$x=''.!!delete $D{$x};telldir(\*STDIN)or quuuux%D;%D=bless({},$x) +; printf STDIN "%d",$x;last}sub quuuuux{quuux for 1;rewinddir$_ or liste +n ($_,1)for\*STDIN;my$z=\(quux);substr($z,0,1)=quuuux integer=>$$z;quuuu +x pack("C",-1)&"\x4B",sub{42};last}quuuuux for 1;%D = {};use Carp;carp", +"
    use Moops; class Cow :rw { has name => (default => 'Ermintrude') }; say Cow->new->name
My first JAPH
No replies — Read more | Post response
by Zarabozo
on Jun 06, 2014 at 07:13

    This is my first JAPH. I'm very passionate about Perl and I thought I had to make at least one in my life. It's probably not a very good one and will seem very rookie for many - but then again, it's my first one and it's a start for me. :-)

    BEGIN{*{0}=sub{print@ _};*{1}=sub{& #@_=__; 0 # print ord sqrt(e) (chr 32)};my$v=chr 97 ;* #$%&&oo11||s/\e\// {'::'.++$v}=do{my$ #? v=$ #v?a:b?v:a?:v:a?c v;sub{&0($v)};}until$ ::{v};}($_=q;kvtu1bop uifs1qfsm1ibdlfs;)=~s /(.)/&$1/xeg;eval for $ # while(1){::{___}} _ =~ /.{2}/g;__END__;
Fork Sort
1 direct reply — Read more / Contribute
by BenGoldberg
on May 31, 2014 at 17:35
    Put the following in a file,
    defined(my $v = <>) or exit; my ($c,@c) = 1; open($_, "|-", "$^X $0") for @c[0,1]; $_ eq $v ? ++$c : print { $c[ $_ lt $v ] } $_ while <>; pop @c; print $v x $c;
    , and run it with an unsorted text file either on stdin, or as a command line argument. The output will be sorted.

Set the new obfuscation standard
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?

    What's my password?
    Create A New User
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others scrutinizing the Monastery: (9)
    As of 2016-04-29 14:28 GMT
    Find Nodes?
      Voting Booth?
      :nehw tseb si esrever ni gnitirW

      Results (441 votes). Check out past polls.