Re: [Cog-book] Small golfing trick
José Castro <[email protected]> Fri, 31 Mar 2006 11:15:08 +0100
| Newsgroups | gmane.comp.lang.perl.golf |
|---|---|
| Message-ID | <[email protected]> |
* Philippe 'BooK' Bruhat ([email protected]) wrote: > Hi, > > I just discovered this, and do not know if it's commonly used in golf > (it's been a long time since I last played): if you only need a single > hash in your script, you can use the symbol table itself. > > Compare the classic "remove duplicate lines" one-liner > > perl -ne'$s{$_}++||print' file > > with > > perl -ne'$$_++||print' file Whoo, nice :-) I'll add it to my notes, thanks :-) > Three characters in one shot! > > -- > Philippe "BooK" Bruhat > > The learned man makes a mistake but once... but the truly stupid keep > practicing until they get it right. > (Moral from Groo The Wanderer #75 (Epic)) > _______________________________________________ > Cog-book mailing list > [email protected] > http://perl-hackers.net/mailman/listinfo/cog-book -- Jose Alves de Castro <[email protected]> http://jose-castro.org/