Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number

Re: Felling a tree JAPH

by Grimy (Pilgrim)
on Sep 04, 2013 at 14:17 UTC ( #1052349=note: print w/replies, xml ) Need Help??

in reply to Felling a tree JAPH

This 4x48 snippet prints JAPH on all Perl version I tested it on.

sub'DESTROY{print${sub'_(_){bless\pop}pop}->[0]} _[J,_[q q q,_[o^O,_[q[,]],_[k,_[r],_[e]],_[h,_[c ],_[a]]],_[P,_[n&_],_[r],_[e],],],_[u,_[a,_[h,_[ r],_[e],],_[n,_[t],_[o],],],_[q[s],_[$"],_[t]]]]

It still uses the “chopping a tree” concept, but the tree is hard-coded, rather than being built dynamically based on a string.

Here it is with indentation to evidence the tree’s structure:

_[J, _[q[ ], _[q[ ], _[q[,]], _[k, _[r], _[e] ], _[h, _[c], _[a] ] ], _[P, _[l], _[r], _[e], ], ], _[u, _[a, _[h, _[r], _[e], ], _[n, _[t], _[o], ], ], _[q[s], _[q[ ]], _[t] ] ] ];

Replies are listed 'Best First'.
Re^2: Felling a tree JAPH
by MidLifeXis (Monsignor) on Sep 04, 2013 at 14:23 UTC
    $ perl -v This is perl, v5.8.8 built for msys $ perl Malformed prototype for main::_: _ at line 2.


      Well then, just replace this _ with a $. It should work the same way, I only chose _ for aesthetic reasons.

      EDIT: Never mind trying, it won’t work, actually. Here’s a fixed version:

      sub'DESTROY{print${sub'_($){bless\pop}pop}->[0]} _[J,_[q q q,_[o^O,_[q[,]],_[k,_[r],_[e]],_[h,_[c ],_[a]]],_[v80,_[l],_[r],_[e],],],_[u,_[a,_[h,_[ r],_[e],],_[n,_[t],_[o],],],_[q[s],_[$"],_[t]]]]
      Tested on 5.8, 5.10, 5.14 and 5.16.

        Cool. It works. I will take a bit of time to look at this later.


Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1052349]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (10)
As of 2018-07-18 12:49 GMT
Find Nodes?
    Voting Booth?
    It has been suggested to rename Perl 6 in order to boost its marketing potential. Which name would you prefer?

    Results (392 votes). Check out past polls.