RE: How to Read Files? [was: Re: learning perl 3rd vs 4th]
[email protected] (Thomas Bätzler)
| Newsgroups | perl.beginners |
|---|---|
| Message-ID | <[email protected]> |
AndrewMcHorney <[email protected]> asked: > The spec does not allow for carriage returns or line feeds > making it a long line. Is there a way to read "x" number of bytes? $ perldoc -f read read FILEHANDLE,SCALAR,LENGTH,OFFSET read FILEHANDLE,SCALAR,LENGTH Attempts to read LENGTH characters of data into variable SCALAR from the specified FILEHANDLE. Returns the number of characters actually read, 0 at end of file, or undef if there was an error (in the latter case $! is also set). SCALAR will be grown or shrunk so that the last character actually read is the last character of the scalar after the read. [...] HTH, Thomas