Perl Programming/Keywords/readline

From Wikibooks, open books for an open world
Jump to navigation Jump to search
Previous: readdir Keywords Next: readlink

The readline keyword[edit | edit source]

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[edit | edit source]

Previous: readdir Keywords Next: readlink