http://www.perlmonks.org?node_id=1035669


in reply to RegEx Matching, Loop Breaking...

Asides from the fact that you need to chomp the data from your file, I think is is probably not a good idea to open, read and close a file for every single line of input of anoher file.

You probably want to read your domain file only once at the beginning, clean and store its content in memory (in an array or a hash) for when you process your other file.