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
In reply to Store regular expressions in a file. by yoda54
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |