I am trying to replace a specific line in a text file with VMS. This is usually a simple single line with Perl. But I ran into a problem when the spare side was a character containing a VMS path. Here is the file and what I tried:
The contents of file1.txt:
foo
bar
baz
quux
Trying to replace the third line:
$ mysub = "disk$data1:[path.to]file.txt"
$ perl -pe "s/baz/''mysub'/" file1.txt
Sets the following output:
foo
bar
disk:[path.to]file.txt
quux
It seems that Perl was an overeager and replaced part of the $data1path with the contents of a nonexistent variable (i.e. nothing). This works with a debugger. I did not supply /e, so I thought Perl should just replace the text as it is. Is there a way to get Perl to do this?
(Also note that I can reproduce similar behavior on the linux command line.)