http://qs321.pair.com?node_id=11119669

nysus has asked for the wisdom of the Perl Monks concerning the following question:

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