Ok, I get the same result as you reported. Playing around with it, I had to add two additional backslashes to get it to work as desired (not sure why):
my $ext='c'; qx("perl -p -i.bak -e \"s/(\\\@Filetyp\\s*?:)/\\1$ext/\" ./path/test.c +"); # ^^
(Note: I also had to specify an extension for the backup file.) This is on Windows; if your O/S is different, it may treat the backslashes differently.
Hope that helps,
| Athanasius <°(((>< contra mundum | Iustus alius egestas vitae, eros Piratica, |
In reply to Re^3: perl one liner to replace matching string
by Athanasius
in thread perl one liner to replace matching string
by vinoth.ree
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |