I opened the file in string context and was able to find the pattern successfully. But I could not substitute the matched pattern with required pattern
$extra = "This is i will place after match\n.an this too"; open (my $fh, '+<', $file); $data = <$fh>; $data = s/(.*entry)\n([^\n]*)\n/$1\n$extra/
The $1 is found successfully. But could not do the substitution in the file.
In reply to Re^2: Regex and writing lines in file
by amma
in thread Regex and writing lines in file
by amma
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |