Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re^4: odd behavior with DATA section

by ikegami (Patriarch)
on Jul 23, 2005 at 05:04 UTC ( [id://477428]=note: print w/replies, xml ) Need Help??


in reply to Re^3: odd behavior with DATA section
in thread odd behavior with DATA section

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.

Replies are listed 'Best First'.
Re^5: odd behavior with DATA section
by GrandFather (Saint) on Jul 23, 2005 at 05:13 UTC

    I get either behaviour depending on if I put a new line on the last line or not. I'm using 5.8.6


    Perl is Huffman encoded by design.

      I've only ran it with a newline. You seem to be missing my point:

      A trailing new line on the "last" line will NOT NECESSARILY generate a last empty line

      It depends on your OS and/or version of Perl.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (5)
As of 2024-04-23 21:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found