Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: Delete last line of file with regex

by tybalt89 (Prior)
on Jul 22, 2020 at 17:41 UTC ( #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
Node Status?
node history
Node Type: note [id://11119670]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (5)
As of 2021-04-23 06:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?