in reply to RESOLVED: Slurping search-replace patterns from a file
This prints:use strict; use warnings; while (<DATA>) { chomp; my ($pat, $repl) = (split '/') [1, 2]; my $s = "foo"; $s =~ s/$pat/qq{"$repl"}/ee; say $s; } __DATA__ s/foo/bar/ s/(fo)o/bar$1/
bar barfo
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Slurping search-replace patterns from a file
by moritz (Cardinal) on Oct 14, 2008 at 15:40 UTC | |
by gone2015 (Deacon) on Oct 14, 2008 at 17:21 UTC | |
by moritz (Cardinal) on Oct 14, 2008 at 17:47 UTC | |
by gone2015 (Deacon) on Oct 14, 2008 at 20:14 UTC | |
by HKS (Acolyte) on Oct 20, 2008 at 20:47 UTC | |
|
Re^2: Slurping search-replace patterns from a file
by oko1 (Deacon) on Oct 14, 2008 at 15:40 UTC | |
by moritz (Cardinal) on Oct 14, 2008 at 15:49 UTC | |
by HKS (Acolyte) on Oct 14, 2008 at 16:01 UTC | |
by JavaFan (Canon) on Oct 14, 2008 at 16:07 UTC |