in reply to Spell Check

I have no doubt that there are modules that do this (Perhaps Text::Ispell or Lingua::Ispell?), but for a quick 1 minute inefficient version, try:

$dictfile="/some/path/to/dictfile"; #Dictfile should have a all words (or regex for words), one per line open (DICT, $dictfile) or die "Can't open $dictfile:$!"; while(<DICT>){ $words{lc($_)}=1; #using hash as cheap lookup #Note that a "real" dictionary file will nail you on efficency her +e. Perhaps a Dbm would be better? } while(<>){ foreach $word (split($_)){ if (!defined($words{lc($word)})){ print "$.:$word?\n"; } } }
(Now the perl wizards will trounce this code, but I'll post it anyways in hopes of learning from them.)

Replies are listed 'Best First'.
RE: Re: Spell Check
by perlcgi (Hermit) on May 30, 2000 at 19:40 UTC
    Now the perl wizards will trounce this code
    Let them, indeed. But you'll still get my vote. Pretty cool in my ragged little book :-)