Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: Destructive JAPH

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


in reply to Destructive JAPH

I wish you good luck on your journey through the darkest corners of Perl.

Hereís a golfed and obfuscated JAPH using the DESTROY trick:

sub'DESTROY{print${+pop}}bless\$_,for',rekcah lreP rehtona tsuJ'=~/./g

The second argument of bless defaults to ::main, which is the package where subs declared without a package prefix go to. You donít need the temporary array: the SVís are still created and blessed even if map is used in void context (other built-ins, like sort, wonít let you do this). This causes them to be GCíd in reverse order, though.


Comment on Re: Destructive JAPH
Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1052161]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (4)
As of 2016-02-08 06:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How many photographs, souvenirs, artworks, trophies or other decorative objects are displayed in your home?





    Results (268 votes), past polls