Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight

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
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1052349]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (1)
As of 2023-10-04 23:31 GMT
Find Nodes?
    Voting Booth?

    No recent polls found