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 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?
[1nickt]: Missing title suppresses the submit button, I think.
[1nickt]: Petroza to answer your question, no, no special permission is needed to post a question.
[LanX]: did you spam before? :)
LanX has to go/
[ambrus]: I hope we didn't mess up the spam filter rules again.
[ambrus]: Our spam filter rules disallow links to certain domains, and some suspicious pharses that have appeared in previous spam advertising cheap online whatevers.
[LanX]: some servers were lagging today, so I suppose the root cause
[LanX]: ambrus no recent patches
[Petroza]: no i haven't posted anything before. It was a more or less long question with a specific issue. I did post a title and the links i added where only part of the element i was searching within the code (so no purpose other than the question itself).
[1nickt]: Petroza can you go back in your browser to the preview screen, redact the links, and try to submit again?

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (10)
As of 2017-10-17 15:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My fridge is mostly full of:

















    Results (233 votes). Check out past polls.

    Notices?