Dan Muey wrote: >> First, (.*) is very greedy. You might want to limit it in >> some way, possibly with a ? modifier like (.*?), possibly by >> looking for less than . such as ([^:]*) -- anything but a colon. >> >> Second, the backwack numbers \1 .. \9 are only for the >> matching portion of a subsitution. You must use their >> variable representations, $1 .. $9 in the replacement portion. >> > > Thanks for the info Casey: > Ok I tried doing this: > > 'file' has one line > datax:hello:2: > my $u = 'datax'; > print qx(perl -pi -e 's/^$u:hello:([^:]*):/$u:goodbye:$1/;' file);
qx interpolates variables. by the time $1 gets to perl, it's already gone. try: print qx(perl -pi -e 's/^$u:hello:([^:]*):/$u:goodbye:\$1/;' file); why not simply: [panda]$ perl -pi -e 's/^datax:hello:([^:]*):/datax:goodbye:$1/;' file [panda]$ david -- $_=q,015001450154015401570040016701570162015401440041,,*,=*|=*_,split+local$"; map{~$_&1&&{$,<<=1,[EMAIL PROTECTED]||3])=>~}}0..s~.~~g-1;*_=*#, goto=>print+eval -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]