in reply to
regex within an input file
It works fine for me when I make $text a quoted string and paste in your lines for the pattern match. So I suppose the problem is with the DATA.
Comment on
Re: exreg within an input file
In Section
Seekers of Perl Wisdom