Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask

Re^3: Store regular expressions in a file.

by BrowserUk (Pope)
on Nov 11, 2010 at 12:13 UTC ( #870840=note: print w/ replies, xml ) Need Help??

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

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.

Comment on Re^3: Store regular expressions in a file.
Download Code

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (8)
As of 2015-12-01 06:16 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (795 votes), past polls