Name
pipe
Synopsis
pipe readhandle, writehandle
Description
Opens a pair of connected pipes.
This call is almost always used right
before a fork
, after which the pipes reader
should close writehandle, and the writer should close
readhandle. (Otherwise the pipe won’t indicate EOF
to the reader when the writer closes it.) Note that if you set up a loop of
piped processes, deadlock can occur unless you are very careful. In addition,
note that Perl’s pipes use standard I/O buffering, so you may need to set
$|
on your writehandle
to flush after each output command, depending on the
application—see select
filehandle.
Get Perl in a Nutshell now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.