in reply to Why is the following instance of Matching using an array element not working
A bit of a stab in the dark without seeing a sample of your data files but, do you need to chomp off the line terminator from each $line? If the text you wish to match is in the middle of the $record then the line terminator at the end of the pattern means you will never succeed.
I hope my guess is close to the mark and that this is helpful.
Cheers,
JohnGG
In Section
Seekers of Perl Wisdom