in reply to how to automate the regular expression match from a file?
use warnings; use strict; [download]
Secondly, add print statements to see what is actually happening (within your loop, for example).