I want to delete the last line of a file but only if it begins with ##
#!/usr/bin/env perl my $slurp; while (<DATA>) { $slurp .= $_; } $slurp =~ s/^###* [^\n]+//m; print $slurp; __DATA__ kjkjksjdf ## Don't del me blah ## deleteme
I don't know how to indicate that nothing should come after the line or how to indicate EOF in a regex.
$PM = "Perl Monk's";
$MCF = "Most Clueless Friar Abbot Bishop Pontiff Deacon Curate Priest Vicar";
$nysus = $PM . ' ' . $MCF;
Click here if you love Perl Monks
In reply to Delete last line of file with regex by nysus
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |