in reply to Re^3: How do I pass $1 to s///?
in thread How do I pass $1 to s///?
...then...~/perl/monks$ cat foo.txt sub{"fish $_[0]"};
$foo_from_file = do "foo.txt"; foo("This is test 1\n", qr/test (.*)/, $foo_from_file); sub foo { (my $text = $_[0]) =~ s/$_[1]/$_[2]->($1)/e; print $text; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^5: How do I pass $1 to s///?
by ikegami (Patriarch) on Jan 06, 2006 at 20:17 UTC | |
by Anonymous Monk on Jan 06, 2006 at 21:03 UTC | |
by ikegami (Patriarch) on Jan 06, 2006 at 21:10 UTC |