Cari di Perl 
    Perl User Manual
Daftar Isi
(Sebelumnya) Output a formatted list to a f ...Get a directory from a directo ... (Berikutnya)
Input and output functions

Fixed-length buffered input from a filehandle

Daftar Isi

  • read FILEHANDLE,SCALAR,LENGTH,OFFSET

  • read FILEHANDLE,SCALAR,LENGTH

    Attempts to read LENGTH characters of data into variable SCALARfrom the specified FILEHANDLE. Returns the number of charactersactually read, 0 at end of file, or undef if there was an error (inthe latter case $! is also set). SCALAR will be grown or shrunk so that the last character actually read is the last character of thescalar after the read.

    An OFFSET may be specified to place the read data at some place in thestring other than the beginning. A negative OFFSET specifiesplacement at that many characters counting backwards from the end ofthe string. A positive OFFSET greater than the length of SCALARresults in the string being padded to the required size with "\0"bytes before the result of the read is appended.

    The call is implemented in terms of either Perl's or your system's nativefread(3) library function. To get a true read(2) system call, seesysread.

    Note the characters: depending on the status of the filehandle,either (8-bit) bytes or characters are read. By default, allfilehandles operate on bytes, but for example if the filehandle hasbeen opened with the :utf8 I/O layer (see open, and the openpragma, open), the I/O will operate on UTF8-encoded Unicodecharacters, not bytes. Similarly for the :encoding pragma:in that case pretty much any characters can be read.

 
Source : perldoc.perl.org - Official documentation for the Perl programming language
Site maintained by Jon Allen (JJ)     See the project page for more details
Documentation maintained by the Perl 5 Porters
(Sebelumnya) Output a formatted list to a f ...Get a directory from a directo ... (Berikutnya)