http://qs321.pair.com?node_id=870806

yoda54 has asked for the wisdom of the Perl Monks concerning the following question:

Monks,

I'd like to read a bunch of regular expressions from a flat text for use in a script. After I read the file, how do I tell Perl thats this 'data' is a regular expression?

I'd like to accomplish something like the following.

#!/usr/bin/perl use strict; use warnings; my $data = "duck"; while(<DATA>) { if ($data =~ $_) { print "$data\n"; } } __DATA__ s/duck/luck/qr