Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re^2: Store regular expressions in a file.

by yoda54 (Monk)
on Nov 11, 2010 at 11:22 UTC ( #870823=note: print w/ replies, xml ) Need Help??


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/


Comment on Re^2: Store regular expressions in a file.
Download Code
Re^3: Store regular expressions in a file.
by cdarke (Prior) on Nov 12, 2010 at 08:29 UTC

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://870823]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (6)
As of 2014-07-26 08:23 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (175 votes), past polls