http://qs1969.pair.com?node_id=294798

This should theoretically be fairly portable, but I've only tested it on 5.6.0/Linux and 5.8.0/ActiveState. If you don't like the first joke it gives you, run it some more times and you won't like the other ones either ;-)

$|++;;($;,$:,$,,$\,$^,$==>$~,$.,$})=("Izntvar n", "Prey pbqr","fpevor"=> "!$/","ernql"=>$^F, "boshfpng","fho",join ' ',@{;;[_(qw(oepgnf rhnuar nfarqr gu))]} [2,$?,3,$|,@;,5]);sub ::{;my$i=$^;;[split /#/,join$`,map{$i^=$_} split//,pop@_]}@%= map{my$die=$_;sub{print for join$',@$die[ $%,$==>$|]}}map{[map{sub {my$i=$!;join$&, map{my$o=$i;$i=$_;$o^$_;} split//,shift}; y;a-z;n-za-m;;$_;}@$_];}([ q"Ia Sbivrg ", "rf lbh","Rhffvn, $: $~"],[ "Ayy lbhe $~" ," ner orybat gb hf","rq $:" ], ["$; orb" ,"rq $:","jhys pyhfgre bs $~" ],["$|. We" .'v'."gr $~","$/3. Pebsvg","r" .qq-q-.' ' .$:.".$/$=. ???"],["Tur arkg ". "$: $~"=> "ef $} vg"." rneyl",q"vba jvyy " .'or'.qq ' $^ fbba, ohg $.$,'] );%_=map {my$z=( ($_|=$^O)?$_:::($_)); $_,sub{ while( pop){my$x=unpack'V',$_ ;push@| ,($x> $_?$x:$_)}print for@|}} 1..1024; ;sub _{+(@;=>@:)=map{[split//]}@_;for(1..9 ){push@:,join$&,map{shift@$_}@;}@:}$%[rand@%]->()
update: code below this point is my signature and is not part of the above obfuscation. I've reworked the sig to start with a semicolon in case someone uses them together, but that was not the intention.
update2: corrected spelling error

;$;=sub{$/};@;=map{my($a,$b)=($_,$;);$;=sub{$a.$b->()} }split//,".rekcah lreP rehtona tsuJ";$\=$ ;->();print;

Replies are listed 'Best First'.
Re: Slashdot lamejoke generator
by Notromda (Pilgrim) on Oct 02, 2003 at 18:15 UTC
    Wow... I'm trying to pick apart how this works, but I'm getting lost in all the map transforms. Here's a few interesting notes that I've found so far... Warning: Spoilers!

      I'm getting lost in all the map transforms

      But, there are only a mere eight of them...

      There's some stuff that is unused... disinformation?

      I included that stuff for three reasons. (SPOILERS:

      )

      this bit of code is a fun transformation

      Yes, I initially wanted to golf that down a little more and/or obfuscate it a little better, and possibly apply it to more of the text, but I ran out of steam.

      It puts an exclamation point and newline on the output record seperator, which I think puts it at the end of the output whenever this program is run.

      Whenever it prints out a string, actually. The only reason it only happens once per run is because it only prints one string per run. When I was developing the thing, I had a loop that for testing purposes called all of the closures, and so !\n was printed after each.

      That's the first time I've ever de-obfuscated a program.

      Addictive, isn't it? The first time I deobfuscated something from Perlmonks, I went nuts afterward and compulsively deobfuscated the next several obfus in a row. It was a couple of days before I wanted to look at "normal" code again.


      $;=sub{$/};@;=map{my($a,$b)=($_,$;);$;=sub{$a.$b->()}} split//,".rekcah lreP rehtona tsuJ";$\=$ ;->();print$/
        I included that stuff for three reasons.

        Actually I guessed the first two, and the third makes sense. I was equally impressed by the :: sub name.

        When I was developing the thing, I had a loop that for testing purposes called all of the closures, and so !\n was printed after each.

        Heh.. well, to de-obfuscate the thing, I put in some Data::Dumper statements. It made the output interesting! :lol:

      Oh, forgot to mention the (ab)use of => as a substitute for the comma seperator.
      2,0,3,1,0,0,0,0,5 is the order

      I was looking at this again (due to an issue someone was having) and happened to notice something I missed before: you parsed this incorrectly. The reference to @; occurs in scalar context, so you get 4 not 0,0,0,0. It always helps to pay attention to context. HTH.HAND.


      ;$;=sub{$/};@;=map{my($a,$b)=($_,$;);$;=sub{$a.$b->()}} split//,".rekcah lreP rehtona tsuJ";$\=$;[-1]->();print
Re: Slashdot lamejoke generator
by NetWallah (Canon) on Oct 03, 2003 at 00:02 UTC
    Excellent ! (++).

    I had to add a semicolon (;) at the end of

    ){push@:,join$&,map{shift@$_}@;}@:}$%[rand@%]->()
    in order to get this to compile. Without that it gives:
    Scalar found where operator expected at SlashDotLameJokeGen.pl line 22 +, near ") $;" (Missing semicolon on previous line?) syntax error at SlashDotLameJokeGen.pl line 22, near ") $;" Execution of SlashDotLameJokeGen.pl aborted due to compilation errors.
    FYI - "This is perl, v5.8.0 built for MSWin32-x86-multi-thread"

    Update: OK - The obfu was fine - I had mistakenly included jonadab's signature as part of the code - causing the error. (This was prior to his update).

      Brilliant! (++) Works fine on coal-fired WIN95 laptop with 5.005. Never lick a gift horse in the mouth.
Re: Slashdot lamejoke generator
by Anonymous Monk on Feb 10, 2004 at 20:25 UTC
    You have a spelling error for "beowulf", unfortunately. It's easily fixed, though. Replace the line
    ],["$; ornh" ,"rq $:","jhys pyhfgre bs $~"
    with
    ], ["$; orb" ,"rq $:","jhys pyhfgre bs $~"
    and all will be well,
    Regards,
    Owen
Re: Slashdot lamejoke generator
by johndageek (Hermit) on Sep 30, 2003 at 12:18 UTC
    great! ++

    dageek

Re: Slashdot lamejoke generator
by thelenm (Vicar) on Sep 29, 2003 at 15:57 UTC

    +5, Funny! By the way, it runs fine with 5.8.1 on Linux.

    -- Mike

    --
    XML::Simpler does not require XML::Parser or a SAX parser. It does require File::Slurp.
    -- grantm, perldoc XML::Simpler

Re: Slashdot lamejoke generator
by mojobozo (Monk) on Sep 29, 2003 at 20:38 UTC
    All your ++ are belong to us! I, too, enjoyed this one. Also worked fine on Win2K Pro with ActiveState (copied from my cmd line: This is perl, v5.6.1 built for MSWin32-x86-multi-thread).

    _____________________________________________________
    mojobozo
    word (wûrd)
    interj. Slang. Used to express approval or an affirmative response to
    something. Sometimes used with up. Source
Re: Slashdot lamejoke generator
by Anonymous Monk on Jan 19, 2004 at 13:54 UTC
    Great job! It was a great distraction for early in the morning on the job.
Re: Slashdot lamejoke generator
by Anonymous Monk on Feb 07, 2004 at 22:02 UTC
    But where are the "hot grits" and "Natalie Portman" refs?

      They're very cleverly obfuscated. So obfuscated, in fact, that you can't actually see them unless you read between the lines. HTH.HAND.


      $;=sub{$/};@;=map{my($a,$b)=($_,$;);$;=sub{$a.$b->()}} split//,".rekcah lreP rehtona tsuJ";$\=$ ;->();print$/
How to run it?
by Anonymous Monk on Mar 22, 2004 at 06:51 UTC

    How to run this beast? I created file joke.pl, it starts with:

    #!/usr/bin/perl $|++;;($;,$:,$,,$\,$^,$==>$~,$.,$})=("Izntvar n", "Prey pbqr","fpevor"=> "!$/","ernql"=>$^F, ...
    but when I run it I get:
    Missing comma after first argument to join or string function at ./jok +e.pl line 7, near "@_]" Execution of ./joke.pl aborted due to compilation errors.
    I run:
    perl -version
    This is perl, v5.8.3 built for i386-linux-thread-multi

    Ugh, help?

    Max

    Edited by Chady -- fixed formatting.

      Missing comma after first argument to join or string function at ./joke.pl line 7, near "@_]"

      Hmmm.... weird. Are you certain you copied it exactly? This is line 7:

      for join$',@$die[        $%,$==>$|]}}map{[map{sub

      There's no occurance of @_] there. There is one on line 6:

      split//,pop@_]}@%=        map{my$die=$_;sub{print

      I don't see anyplace there on line 6 where a comma is wanted, so maybe it really is talking about line 7, but on line 7 there most certainly is a comma after the first argument to join.

      It has been reported to work on versions from 5.005 through 5.8.1, but it is possible that something changed from then to 5.8.3 that throws it off. If for example $' were handled differently, that could maybe break it. Or if the precedence tables changed -- but that seems unlikely; I don't thing the precedence tables are going to change much in Perl5, because that would break *lots* of existing code. (Perl6 is going to change them, but Perl6 is changing *lots* of stuff; Perl5 code will not be able to parse as Perl6 code and mean the same thing, generally, though Perl6 will be able to parse it as Perl5 code.)

      I'm not sure what the newest Perl I have access to is, but I'm pretty sure it's not 5.8.3, so I'd have to do an upgrade. I can't justify that here; maybe at home later, time permitting -- but doublecheck also to make sure you have the code copied exactly.


      ;$;=sub{$/};@;=map{my($a,$b)=($_,$;);$;=sub{$a.$b->()}} split//,".rekcah lreP rehtona tsuJ";$\=$;[-1]->();print
Re: Slashdot lamejoke generator
by exussum0 (Vicar) on Sep 30, 2003 at 04:35 UTC
    A pox on your soul. It was teh funny and teh money.
    Play that funky music white boy..