Jump to content

Perl Programming/Keywords/getc

From Wikibooks, open books for an open world
Previous: ge Keywords Next: getgrent

The getc keyword

[edit | edit source]

The getc function returns the next character form the input file attached to FILEHANDLE, or the undef when the end of file is reached or an error occurred. An error will also set $!). If the FILEHANDLE is omitted, the function reads from STDIN. This is not very efficient and cannot be used by itself to fetch single characters without waiting for the user to hit enter.

Syntax

[edit | edit source]
  getc FILEHANDLE
  getc
Previous: ge Keywords Next: getgrent