in reply to Re: Define regex substitution $1,$2,... from a string
in thread Define regex substitution $1,$2,... from a string
Thank you for your suggestion.
Could you kindly let me know what's wrong with my commands when I'm trying reproduce your example as below?
@$> perl -e '$_="h:/p/f.zip";$replace=q[qq<x?f=$1>];s/([^/]+)$/$replac +e/e+e;say' Scalar found where operator expected at -e line 1, near "s/([^/]+)$/$r +eplace" Final $ should be \$ or $name at -e line 1, within string syntax error at -e line 1, near ";s/([^/]+)$/" Execution of -e aborted due to compilation errors. @mnsdev10> perl -v This is perl, v5.8.8 built for sun4-solaris Copyright 1987-2006, Larry Wall Perl may be copied only under the terms of either the Artistic License + or the GNU General Public License, which may be found in the Perl 5 source ki +t. Complete documentation for Perl, including FAQ lists, should be found +on this system using "man perl" or "perldoc perl". If you have access to + the Internet, point your browser at http://www.perl.org/, the Perl Home Pa +ge. @$> perl -e '$_="h:/p/f.zip";$replace=q[qq<x?f=$1>];s|([^/]+)$|$replac +e|ee;say' @$>
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Define regex substitution $1,$2,... from a string
by choroba (Cardinal) on May 24, 2016 at 07:52 UTC |