in reply to Re^2: Unexpected result using tell/seek within the __DATA__ file
in thread Unexpected result using tell/seek within the __DATA__ file
Perl reads the source code using readline and not using binmode. This means that tell needs to guess at what the difference is between where perl stopped reading stuff into the buffer and where your script stopped reading stuff out of the buffer.
So perl gets the accurate seek position of the end of the buffered data and then subtracts the number of bytes in the buffer. For every "\n" in the buffer, there were two bytes ("\r\n") in the file so the tell result is "off" by that many bytes.
- tye
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Unexpected result using tell/seek within the __DATA__ file (buffer)
by Gulliver (Monk) on Mar 11, 2011 at 19:49 UTC | |
|
Re^4: Unexpected result using tell/seek within the __DATA__ file (buffer)
by Gulliver (Monk) on Mar 11, 2011 at 22:11 UTC |