in reply to Re: fun with subroutines
in thread fun with subroutines

Playing with it was inspiring, and i attempted to roll my own a bit. Very fun!

For portabilities sake you might want to use sort '_qsort', which fixed it for me, if perl 5.8.0. It's 3am, and i've just had one of the weirdest sober nights in my life, so i'm in no condition to think of how to selectively load pragmatic modules right now.

++ once more... and good night.

-nuffin
zz zZ Z Z #!perl

Replies are listed 'Best First'.
Re: fun with subroutines
by jonadab (Parson) on Apr 21, 2003 at 20:57 UTC

    I've found a more portable way to abuse sort: use a sort function that does result in a defined order, but obfuscate it. For a (quite rudamentary) example, see my new signature:

    {my$c;$ x=sub{++$c}}map{$ \.=$_->()}map{my$a=$_->[1]; sub{$a++ }}sort{_($a->[0 ])<=>_( $b->[0])}map{my@x=(& $x( ),$ _) ;\ @x} split //, "rPcr t lhuJnhea eretk.as o";print;sub _{ord(shift)*($=-++$^H)%(42-ord("\r"))};

    Of coures, for serious obfuscation something much more obscure than modular arithmetic would be called for in the sort function, but this is just a JAPH.