http://www.perlmonks.org?node_id=908478

Greetings!

I realized that my previous JAPH was thoroughly unattractive because you had to squint in order to decipher it, which isn't pleasant. That's why I came up with this one. It is based on the same idea of extracting JAPH one character at a time from successive iterations of the SHA512 of the code, but now features whitespaces(!) and pretty symmetrical subroutines. I hope you have as much fun understanding it as I had writing it. Here it is:

use strict; use Digest::SHA substr(q/=sha512(\/), $/, q); %_ = (undef($/) && (open *q, $0) => undef($/) || ($/=<q>) !~ s+= \w\+=+= =+??? : 6); $/ =~ s+[\xD\xA]\++\xA+g; $_ = aJcpbneUbBdThmaWbMqehybAhIkAaPeYavrNcjd0bvb9gxfjay=>; y #a-zA-Z0-9_$/y #\0->y;#; y #a-zA-Z0-9_$/y #\0->y;#; print substr($/=sha512($/), $_, 1) for (map &_ => /./gs); sub _ ( ) { # } ( ) _ dus sub x ($) { ! q ! } ($) x dus { 0 x (0) rox ! xor (0) x 0 } !((//m...//m) ^ (m\\...m\\))? (64)x + (ord) : (ord) + x(49) } # {

perl -w it, it runs without warnings and prints exactly "Just another Perl hacker,".

Good start points to understand what happens:

EDIT: Here's an alternative version of the code that doesn't read it's own source, making it more portable (possible use as a one-liner, no trailing whitespace problem) but much less interesting:

Replies are listed 'Best First'.
Re: Pulling JAPH out of the iterated SHA512 of the code...
by Your Mother (Archbishop) on Jun 07, 2011 at 17:45 UTC

    Or did you mean it prints ▒:▒v▒Y1_jg▒)Jd▒▒▒▒▒<љPuTTY$ PuTTY? Because that's what it prints for me from a file and it prints nothing from an "in term" execution.

      It's perfectly normal that it prints nothing from an inline execution. I don't know how you could "open FILEHANDLE $0" an inline code.

      When you copy it to a file, you have to make sure that it is an EXACT copy. Adding or removing a single whitespace anywhere will change the SHA512 and thus result in printing random characters, like what you had.

      Empty lines are really empty, there's one trailing newline at the end so that the downloaded version works too, and the end of each line is really the end of the line (no trailing spaces). Only the fifth line is indented with exactly 3 spaces.

        curl 'http://perlmonks.org/?abspart=1;displaytype=displaycode;node_id=908478;part=1' -o a.pl
          % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                         Dload  Upload   Total   Spent    Left  Speed
        100   531    0   531    0     0   1618      0 --:--:-- --:--:-- --:--:--     0
        
        perl a.pl
        ▒-+▒v▒▒▒▒▒eվ▒▒* ▒@*▒}▒
        

        (updated, cleaned up command line.) You're right, copying it exactly did result in different output. :P