Given a word W, I want to find all words containing the letters in W from /usr/dict/words. For example, \"bat\" should return \"bat\" and \"tab\" (but not \"table\").
He
#!/usr/bin/perl $myword=join("", sort split (//, $ARGV[0])); shift; while (<>) { chomp; print "$_\n" if (join("", sort split (//)) eq $myword); }
Use it like this: bla.pl < /usr/dict/words searchword
bla.pl < /usr/dict/words searchword