@$> perl -e '$_="h:/p/f.zip";$replace=q[qq];s/([^/]+)$/$replace/e+e;say' Scalar found where operator expected at -e line 1, near "s/([^/]+)$/$replace" 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 kit. 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 Page. @$> perl -e '$_="h:/p/f.zip";$replace=q[qq];s|([^/]+)$|$replace|ee;say' @$>