If it's not a huge file, I'd use File::Slurp (or maybe File::Slurper if the issues it fixes are relevant for your case).
@lines = read_file($file); pop @lines if $lines[-1] =~ /^##/; write_file($file, @lines);
In reply to Re: Delete last line of file with regex
by ForgotPasswordAgain
in thread Delete last line of file with regex
by nysus
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |