getc#

Synopsis#

$ch = getc($fh);   # one character from $fh
$ch = getc();      # one character from STDIN

Description#

Reads a single character from a filehandle.

Returns the next character from the specified filehandle as a one-character string. When called without arguments, reads from STDIN (filehandle id 0). Returns undef at end-of-file or on error.

Accepts both lexical ($fh) and bareword (FH) filehandles.

See also#

readline, read, eof