@lines = read_file($file); pop @lines if $lines[-1] =~ /^##/; write_file($file, @lines);