in reply to can you please fix the error

My suspicion is that $word and $stop are never equal to each other, so the line

next if $word eq $stop;

is never true.

You are loading @data in paragraph mode (may contain newlines) and @stopwords in line mode with chomp (will not contain newlines). Could your problen lie there? Without some test data, it is hard to say exactly what the problem is.