Output#!/usr/bin/perl use strict; use warnings; my $file; my $match = "that"; my $extra = "Hello, I snook in here\nme too!"; { local $/; $file = <DATA>; $file =~ s/$match\n([^\n]*)\n([^\n]*)/$match\n$1\n$2\n$extra/; } print $file; __DATA__ this that leave me leave me move me and me
this that leave me leave me Hello, I snook in here me too! move me and me
Cheers,
R.
In reply to Re: Regex and writing lines in file
by Random_Walk
in thread Regex and writing lines in file
by amma
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |