[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [FWP] nuts is stun spelled backwards



On Tue, Oct 17, 2000 at 01:49:35PM +0300, Ilmari Karonen wrote:
> 
> 
> On Mon, 16 Oct 2000, Ronald J Kimball wrote:
> > 
> > perl -nle'$h{$r=reverse}?push@w,"$r $_":$h{$_}++;END{map print,sort@w}'
> 
> Assuming the word list is alphabetized helps a lot.  (This wasn't
> explicitly stated in the original post, but should be true for any
> reasonable list.)
> 
>   perl -nle'$h{$r=reverse}?print"$_ $r":$h{$_}++'  /usr/dict/words

Sneaky of you to swap the order of the words so it looks like the output is
sorted properly.  But that puts the list in alphabetical order by the
second word, not the first word.

Ronald

==== Want to unsubscribe from Fun With Perl?  Well, if you insist...
==== Send email to <fwp-request@technofile.org> with message _body_
====   unsubscribe