<?xml version="1.0" encoding="windows-1252"?>
<node id="965457" title="How to (ab)use sort" created="2012-04-17 04:56:35" updated="2012-04-17 04:56:35">
<type id="1588">
obfuscated</type>
<author id="908014">
Grimy</author>
<data>
<field name="doctext">
sort is, like, the single most abusable function in all of Perl. Seriously, side effects in the sorting code!
&lt;code&gt;use strict;
use warnings;()=
sort{index+0x47,&amp;$a($b)}sub{print&amp;{;pop}},
sort{sub J{$!++&amp;1}[0]}sub{exec''},map{@$_}
sort{sub _{[(pop)x((1&lt;&lt;$!--&gt;&gt;47)|1)]}!{()=
sort{my$_=$a;$a=_(sub{$_})if!/0/}$a,$b,0}}
sort J('rke%ca hlrPe rhetoan tus;J')=~/./g&lt;/code&gt;

Obviously, this code depends on the internal, unspecified implementation of sort. I only tested it on Strawberry Perl 5.14.2 (64 bits); please let me know whether it works anywhere else.

Edit: minor code improvements.</field>
</data>
</node>
