On topic: The Wednesday Challenge

Aidan Samuel aidan.samuel at gmail.com
Wed Aug 15 16:09:26 BST 2007

On 8/15/07, Andy Armstrong <andy at hexten.net> wrote:
> On 15 Aug 2007, at 15:37, Aidan Samuel wrote:
> > Terrible I know, but I just wanted to be the first!
> >
> > perl -e 'my%x=();while (<>){$x{$_}++for unpack("C*",$_)}print
> > chr($_)x$x{$_}for sort keys%x;' < 64m.bin > 64m.sorted.bin
> I'd say that's pretty good :)
> For added credits how about doing it without sort at all?
> --
> Andy Armstrong, hexten.net

Thanks! If I now re-wrote sans sort, I think it's would just look like
Andy Armstrong's solution.

Unfortunately by the time I'd posted I was already second place (and
second best). Don't know why I didn't think of using an array!

What's all this $/=\1 jazz? I've only seen \1 used in old regexes.


More information about the london.pm mailing list