The output you are getting is what you should be getting with the code you are using. You are checking to see the letter 'e' exists in the line not in each of the words in the line. $test holds the entire line.

If you want to split it into each of the words you can do something like this.