develooper Front page | | Postings from July 2002

Re: Golf this.

Thread Previous | Thread Next
July 15, 2002 23:08
Re: Golf this.
Message ID:
En op 16 juli 2002 sprak Tor Hildrum:
>I was considering starting a first ever newbie golf hole,
> but I chickened out.
> I would still like some help with golfing my solution down a couple of
> strokes. It's pretty trivial:
> open F,$_[0];while(<F>){$h{$_}=$i;}foreach$k(%h){print"$k";}'
> It's basically just supposed to copy the 'sort -u' function.
> I'm pretty satisfied with it, but I'm pretty sure there is another
> algorithm. 

Yours removes duplicates but does not sort.
How about this?

#!perl -p


Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About