Great job. cristian++

With the indulgence of the monks I will try my hand at a spoiler.

First, the output from perltidy.
sub _ : { print $_[$%] and ( z &'q' ); } $= = *= = _( z &'n' ) and $= .= *::_ = ( _ . ( z &'l' ) ) and $= =~ s~\*.*:~\x61~ and print $=
Now I'll replace 'and' with ';', evaluate character bitwise &, and replace builtin $%.
sub _ : { print $_[0] ; ( 'p' ); } $= = *= = _( 'j' ); $= .= *::_ = ( _ . ( 'h' ) ); $= =~ s~\*.*:~\x61~; print $=
It is starting to look normal isn't it? Now we'll take line by line.
sub _ : {
The colon is not a valid name so Perl ignores it. So we have a simple subroutine. ( 'p' ) is the same as return 'p' leaving us with:
sub _{ print $_[0];return 'p'}
Next:
$= = *= = _( 'j' );
The first assignment is bogus which leaves us with an assignment to a typeglob. The subroutine _() prints the 'j' and returns the 'p' to be assigned to the typeglob.
$= .= (*::_ = ( _ . 'h' ) );
I rearranged the parentheses. This is the tricky part and does the bulk of the work. Starting from the right. We have an 'h' which is concantenated with the returned 'p' from the subroutine, but the eval is assigned to the typeglob of the subroutine. The typeglob appended to 'ph' is assigned to $= to give '*main::ph'. Since _() was called with no arguments nothing is printed, which also means warnings fails.

An interesting side effect which sidetracked me for some time was what happens when _() exits. Here I'm a little very unsure of the exact sequence but when the eval goes out of scope a DESTROY is called on the typeglob, that includes the Handle =. This results the interesting call: "IO::Handle::DESTROY(/usr/local/lib/perl5/5.8.5/mach/IO/Handle.pm:326): 326: sub DESTROY {}" which is harmless.

$= =~ s/\*.*:/a/
A straight forward substitution to replace the '*main::' with the character 'a'. $= now contains 'aph' which is next printed to finish the 'japh'.

Thank you for you indulgence oh patient monks.


s//----->\t/;$~="JAPH";s//\r<$~~/;{s|~$~-|-~$~|||s |-$~~|$~~-|||s,<$~~,<~$~,,s,~$~>,$~~>,, $|=1,select$,,$,,$,,1e-1;print;redo}

In reply to Re: Simply JAPH by starbolin
in thread Simply JAPH by cristian

Title:
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, details, 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, summary, 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.