in reply to Perl inline replace with execution results
sk found two problems, here's a couple more. Your mytool.pl line will not run without a path indication unless its directory is in your $PATH. Double quoting is undesirable since it will make the shell try to interpolate. This works for me,
It was necessary to escape '/' in the path because we used it for the substitution delimiter.$ cat >mytool.pl #!/usr/bin/perl print 'Substitute string'; $ chmod 755 mytool.pl $ cat >test.tmpl This is mytool.pl foo $ perl -pe's/(mytool\.pl\b.*)/`.\/$1`/e' test.tmpl This is Substitute string $
After Compline,
Zaxo
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Perl inline replace with execution results
by skerr1 (Sexton) on Oct 23, 2005 at 13:26 UTC |