dimanche 25 novembre 2018

Perl: How to substitute the content after pattern

So I cant use $' variable

But i need to find the pattern that in a file that starts with the string “by: ” followed by any characters , then replace whatever characters comes after “by: ” with an existing string $foo

im using $^I and a while loop since i need to update multiple fields in a file.

I was thinking something along the lines of [s///]

s/(by\:[a-z]+)/$foo/i

I need help. Yes this is an assignment question but im 5 hours and ive lost many brain cells in the process

Aucun commentaire:

Enregistrer un commentaire