Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses

Better random magic

by BenGoldberg (Sexton)
on Dec 29, 2013 at 20:11 UTC ( #1068701=obfuscated: print w/replies, xml ) Need Help??

Although the text of the japh is plainly readable in the code, what exactly happens to the split up letters that are passed to _ and __ is... a secret!

sub r{srand$^T; @_}sub b{do{@b=map.5<rand,@_}until grep($_,@b)&&grep( !$_,@b);@b}sub _{print(@_),return if@_<2;my(@L,@R);push@{$_?\@L:\@R}, shift for&b;_(@L);_(@R)};sub __{1<@_ or return@_;my@b=&b;my$c=grep$_, @b;my@L=__(@_[0..$c-1]);my@R=__(@_[$c..$#_]);map shift@{$_?\@L:\@R}, @b}_ r __ r split//,"Just Another Perl Hacker,\n";

If you aren't confused yet, run the code in a debugger, and note the list that __ returns, then try to figure out how _ magically prints the letters in the correct order.

Also... I'm fairly sure that this code (unlike my previous randomized JAPH) should be run ok on any perl, even though I've only tested it on 5.12.1

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: obfuscated [id://1068701]
Approved by tobyink
[Lady_Aleena]: Corion, so do you think the gods would be open to taking over Cookies should I disappear for too long a time?
[Corion]: Lady_Aleena: Yes, I think so, but maybe someone else might also take care of the cookies ;)
[Lady_Aleena]: I'll put it out there.

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (5)
As of 2017-04-26 08:38 GMT
Find Nodes?
    Voting Booth?
    I'm a fool:

    Results (471 votes). Check out past polls.