Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
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??


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

I see.

Thanks

  • Comment on Re^2: Store regular expressions in a file.

Replies are listed 'Best First'.
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?
[marioroy]: stevieb :)
[marioroy]: that is funny, made me smile. miss those days
[marioroy]: thank you, humor of the day stevieb++
[1nickt]: Sad that so much of our humour these days is dry, wry, gallows humor :-/
[1nickt]: One of the great human characteristics .... to laugh in the face of doom :-)

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (7)
As of 2017-03-26 18:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Should Pluto Get Its Planethood Back?



    Results (315 votes). Check out past polls.