Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re^5: How can you sysread an entire file?

by ikegami (Pope)
on Jan 13, 2006 at 22:10 UTC ( #523099=note: print w/ replies, xml ) Need Help??


in reply to Re^4: How can you sysread an entire file?
in thread How can you sysread an entire file?

I linked to a thread that discusses the bug in the two sentence paragraph in which I mentioned the bug. In some versions of Perl, sysread acts as if binmode is on, even when it's not. When binmode is on, "\n" is not the end of line marker, yet you're splitting on "\n".

Ok, fine, you won't have a problem in Windows until it's time to chomp, when you'll find the "\r" is not being removed along with the "\n".


Comment on Re^5: How can you sysread an entire file?
Select or Download Code
Re^6: How can you sysread an entire file?
by NeilF (Sexton) on Jan 13, 2006 at 23:11 UTC
    I never do a chomp... Every record keeps its "\n" (at the end) and is written back out with it again.

    I don't plan on splitting the record (variable) while reading - unless there's a good reason. I'll read it all in, then split it on "\n" to put it into an array.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (7)
As of 2014-12-26 00:27 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (163 votes), past polls