On topic: The Wednesday Challenge

Robin Barker Robin.Barker at npl.co.uk
Wed Aug 15 15:34:30 BST 2007

> $ 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.

Does this work? I've never used $/ = \number.

$/ = \1;
@bytes = (0) x 256;
while( <> ) { $bytes[ord]++ }
for (0..255) { print chr x $bytes[$_] }


This e-mail and any attachments may contain confidential and/or
privileged material; it is for the intended addressee(s) only.
If you are not a named addressee, you must not use, retain or
disclose such information.

NPL Management Ltd cannot guarantee that the e-mail or any
attachments are free from viruses.

NPL Management Ltd. Registered in England and Wales. No: 2937881
Registered Office: Serco House, 16 Bartley Wood Business Park,
                   Hook, Hampshire, United Kingdom  RG27 9UY

More information about the london.pm mailing list