Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: Delete last line of file with regex

by tybalt89 (Monsignor)
on Jul 22, 2020 at 17:41 UTC ( [id://11119670]=note: print w/replies, xml ) Need Help??


in reply to Delete last line of file with regex

#!/usr/bin/perl use strict; # https://perlmonks.org/?node_id=11119669 use warnings; my $slurp; while (<DATA>) { $slurp .= $_; } $slurp =~ s/^##.*\n\z//m; print $slurp; __DATA__ kjkjksjdf ## Don't del me blah ## deleteme

Log In?
Username:
Password:

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

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

    No recent polls found