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

select

Sets the default output filehandle or performs I/O multiplexing.

1-argument form: Sets the default output filehandle (used by print and write when no explicit handle is given) and returns the previously selected handle. With no arguments, returns the current default output handle name without changing it.

4-argument form: Wraps the POSIX select(2) system call. Waits for I/O readiness on the file descriptors encoded in the bit vectors RBITS (readable), WBITS (writable), and EBITS (exceptional). TIMEOUT is in seconds (may be fractional). Returns the number of ready descriptors, or -1 on error.

Synopsis

$prev = select($fh);                                # 1-arg form
$nfound = select($rbits, $wbits, $ebits, $timeout); # 4-arg form

See Also

print, IO::Select, fileno