>>>>> "R" == Ronald J Kimball <rjk@linguist.dartmouth.edu> writes: R> On Tue, Oct 17, 2000 at 06:45:19PM -0500, David L. Nicol wrote: >> Peter's spec does not say anything about the ordering of the words >> w/in the pair. I believe Ilmari's putt reaches the hole. R> I believe you're splitting hairs. What's the point of sorting R> alphabetically by the word that comes second alphabetically? At the risk of taking this too far... We have Ronald's solution (including Steve Lane's one char improvement): perl -nle'$h{$r=reverse}?push@w,"$r $_":$h{$_}++}END{map print,sort@w' words and Ilmari's solution, which has been disputed: perl -nle'$h{$r=reverse}?print"$_ $r":$h{$_}++' words But this can be kludged and surprisingly is still shorter: sort -r words|perl -nle'$h{$r=reverse}?print"$_ $r":$h{$_}++'|sort This also removes Ilmari's assumption that the list is sorted to start with. ;-) Personally I think this goes against the spirit of Perl golf, but I bring this up, because I arrived at the Ilmari solution independently, (but after Ilmari :-}), so I kind of wanted to defend the "home team." And bringing two threads together (the "Wanted - Have = Need" thread's emphasis on "Perl's not always the best solution"). I suppose there could be two divisions of Perl golf: Pure Perl Golf in which you can only use Perl, no forking, no piping, just you, Perl and the problem. Perl Power Tool Golf in which you can use anything in the PPT, forking, piping, etc just as long as it would run on pretty much any platform with the PPT installed. Kind of like "clean" and "open" (aka steroids) body building competitions. ;-) Hope you have a very nice day, :-) Tim "geez, get a life" Ayers (tayers@bridge.com) P.S. Which reminds me of something I can't remember. Was the use of modules legal in the Perl Golf Apocalypse? I remember forking wasn't. ==== Want to unsubscribe from Fun With Perl? Well, if you insist... ==== Send email to <fwp-request@technofile.org> with message _body_ ==== unsubscribe