in reply to RE: Find anagrams
in thread Find anagrams

Here's my stab at it. This fixes the CR/LF problem (that being no one should have to care what format a file was saved on what machine, be it Windows, *nix, or Mac), and handles multiple words per line. Oh yea, and no local variables declared!

I have this gut feeling that it can be reduced further, but I can't find it.
#!/usr/local/bin/perl -w use strict; push @{$ARGV[0] {join '', sort split //}}, $_ for map {lc} map {split} + <DATA>; @$_>1 && print join (',', @$_), $/ for values %{$ARGV[0]}; __DATA__ and dna Stain satin Not in this life Ton one file
--Chris

e-mail jcwren