Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re^2: Store regular expressions in a file.

by Anonymous Monk
on Nov 11, 2010 at 11:52 UTC ( #870836=note: print w/ replies, xml ) Need Help??

Comment on Re^2: Store regular expressions in a file.
Re^3: Store regular expressions in a file.
by BrowserUk (Pope) on Nov 11, 2010 at 12:13 UTC

    This also works:

    #!/usr/bin/perl use strict; use warnings; my $data = "duck"; while(<DATA>) { chomp; my( $find, $replace ) = split ' ', $_, 2; if( $data =~ s[\Q$find][$replace]e ) { print "$data\n"; } } __DATA__ duck luck

    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (5)
As of 2014-09-20 19:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (160 votes), past polls