On topic: The Wednesday Challenge
Andy Armstrong
andy at hexten.net
Wed Aug 15 15:57:25 BST 2007
On 15 Aug 2007, at 15:34, Robin Barker wrote:
>> 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[$_] }
Dunno - but it's close to what I had in mind. Clearly that test was
far too easy for clever people :)
--
Andy Armstrong, hexten.net
More information about the london.pm
mailing list