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

Re: [FWP] nuts is stun spelled backwards



Ilmari Karonen wrote:
> ... 
>   perl -nle'$h{$r=reverse}?print"$_ $r":$h{$_}++'  /usr/dict/words

Another approach:

    perl -ape'$_=$h{$r=reverse@F};@h{@F}="$r @F\n"'

If you want palindromes (like "refer") too, you can do it in one fewer
stroke:

    perl -ape'@h{$r=reverse@F}|="$r $_";$_=@h{@F}'

Cheers,
Tom

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