\begin{Jobst Schmalenbach} > I have written a perl script which has somewhere in the code > > $rc = ($content =~ s/$regfrom/$regto/); > > $regfrom and $regto are passed to the script from the command line. > I want to do: > > ../bin//sitesed.pl -r 'CommonFooter.cgi\?([a-z]*) /somepath/([a-z]*) blah' >'SomeNew/$1 someother/$2' > then it finds all occurences but does not replace it instead I get > > ..... > SomeNew/$1 someother/$2 > ..... > > > If I now hardcode the stuff into it, like: > > $rc = ($content =~ s/$regfrom/SomeNew$1 someother$2/); > > it does exactly what I want, eg: > > ..... > SomeNew/one someother/two > ..... >
$rc = ($content =~ s/$regfrom/eval "\"$regto\""/e); don't ask. its too late at night. (if $regfrom will not change during the script, adding the 'o' option to s/// will make things run faster) -- - Gus -- SLUG - Sydney Linux User Group Mailing List - http://slug.org.au/ More Info: http://lists.slug.org.au/listinfo/slug