in reply to Re: Store regular expressions in a file.
in thread Store regular expressions in a file.

So something like this? I don't get any output.

Thanks

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

Replies are listed 'Best First'.
Re^3: Store regular expressions in a file.
by cdarke (Prior) on Nov 12, 2010 at 08:29 UTC