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 (Patriarch) 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.