in reply to Re^2: More efficient way to exclude footers
in thread More efficient way to exclude footers
But if the last line of the file ends not with newline, second regex do not match and don't delete anything.
That can easily be fixed by changing the regex object definition
my $line_regex = qr/[^\n]*\n/;
to
my $line_regex = qr/[^\n]*\n?/;
(note final \n has ? quantifier added). (Tested.)
But you need to go one step further in the example: show extraction of each remaining line for further processing.
Update: And see also File::Slurp.
Give a man a fish: <%-{-{-{-<
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: More efficient way to exclude footers
by rsFalse (Chaplain) on Aug 19, 2015 at 18:09 UTC |