$file = join('',<>); $file =~ s/\n/ /g; $file =~ s/ +/ /g; @file = split(' ',$file); foreach $word (@file) { $word =~ s/[\!\@\#\$\%\^\&\*\(\)\_\+\=\|\\\~\`\[\]\{\}\:\;\'\"\,\.\<\>\/\?1-9]//g; (length($word)>=5)?$wordlist{lc($word)}=1:next; } open(LIST,">wordlist.txt"); foreach $word (keys %wordlist) { $i++; print LIST "$word\n"; } close(LIST); print "$i words found. Saved in wordlist.txt\n";