Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

getc

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.

Synopsis

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

See Also

readline, read, eof