< Perl Programming < Keywords

The readline keyword

readline is a function that reads from the filehandle whose typeglob is contained in EXPRESSION. Without a parametre, it reads from *ARGV. If called in scalar context, it reads the file line-by-line until end-of-file is reached. After this, the function returns undef. If called in list context, it reads till end-of-file and returns a list of lines. (The definition of a line is given by $/ or $INPUT_RECORD_SEPARATOR).

Syntax

  read EXPRESSION
  read
This article is issued from Wikibooks. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.