Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: odd behavior with DATA section

by GrandFather (Saint)
on Jul 22, 2005 at 23:54 UTC ( [id://477385]=note: print w/replies, xml ) Need Help??


in reply to odd behavior with DATA section

A trailing new line on the "last" line will generate a last empty line. Stick your blank line detector back in or remove the trailing new line.


Perl is Huffman encoded by design.

Replies are listed 'Best First'.
Re^2: odd behavior with DATA section
by Nkuvu (Priest) on Jul 23, 2005 at 00:50 UTC
    Unfortunately I'm not just getting a blank line at the end of the DATA block. I'm getting it between each and every line in the DATA block. Just the trailing newline I understand, this issue I don't.
Re^2: odd behavior with DATA section
by ikegami (Patriarch) on Jul 23, 2005 at 00:08 UTC
    For future reference, that's only the case for Windows, or it's at least not true for unix.

      You mean the Unix file system strips trailing new lines from a file? Surely that would be a rather obnoxious thing for any file system to do?

      Perhaps I should make it clear that by new line I mean what ever line end indicating convention might be used by whatever OS you happen to be using (CR for MAC, LF for *nix, CRLF for DOS/Windows).


      Perl is Huffman encoded by design.
        You mean the Unix file system strips trailing new lines from a file?

        No, we were talking about whether a blank line is returned at the end or not.

        $\ = "\n"; print length while <DATA>; __DATA__ 1 2 3

        Windows prints 2, 2, 2, 0.
        FreeBSD prints 2, 2, 2.

        Update: I'm getting inconsistent results in Windows:
        Win2k, ActivePerl 5.6.0, (at work) I got 2,2,2,0.
        Win2k, ActivePerl 5.8.6, (at gf's) I get 2,2,2.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others perusing the Monastery: (4)
As of 2024-04-24 06:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found