in reply to Extract word

The first problem is that you do the same thing regardless of the truth of defined $ignore{$word}.

You could use the following:

perl -pe's/\band\b//g;' in > out
Or maybe you want to skip the entire line:
perl -ne'print if !/\band\b/;' in > out