Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: Delete last line of file with regex

by jwkrahn (Abbot)
on Jul 22, 2020 at 22:13 UTC ( [id://11119684]=note: print w/replies, xml ) Need Help??


in reply to Delete last line of file with regex

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 .= $_; }
my $slurp; while (<DATA>) { last if eof && /^###* /; $slurp .= $_; }

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11119684]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (4)
As of 2024-04-25 18:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found