in reply to Re: New Line at End File
in thread New Line at End File


This also strips the last newline from the file.

Changing the last line to the following should fix it:

my $pos = tell F; truncate F, 1 +$pos if $pos > 1;

--
John.

Replies are listed 'Best First'.
Re: Re: Re: New Line at End File
by sauoq (Abbot) on Dec 10, 2002 at 19:55 UTC
    This also strips the last newline from the file.

    Of course it does. That's exactly what was asked for. The OP read, "Is there an easy way to determine if there are new line characters at the bottom of a file, and if so delete them?" He didn't ask how to delete all but one newline or how to remove blank lines.

    -sauoq
    "My two cents aren't worth a dime.";
    

      You are right. I stand corrected.

      --
      John.