On topic: The Wednesday Challenge

Andy Armstrong andy at hexten.net
Wed Aug 15 18:28:51 BST 2007


On 15 Aug 2007, at 17:20, Peter Corlett wrote:
> On 15 Aug 2007, at 15:01, Andy Armstrong wrote:
>> Given a 64 Mbyte file containing random binary data write a perl  
>> program such that
>> $ perl myprog.pl < 64m.bin > 64m.sorted.bin
>> outputs a file 64m.sorted.bin with all the bytes sorted in  
>> ascending order. Marks will be given for speed, brevity and  
>> parsimonious use of memory.
>
> #!/usr/bin/perl -C0 -anF//
> ++$_[ord]for at F}{print chr()x$_[$_]for(0..$#_)

Yeah baby!

-- 
Andy Armstrong, hexten.net



More information about the london.pm mailing list