[Chapter 3] 3.2.107 pipe
Author: Larry Wall, Tom Christiansen & Randal L. Schwartz
Date: 1999-07-02T01:52:16Z

#

| Chapter 3 Functions |

### 3.2.107 pipe

    pipe READHANDLE, WRITEHANDLE

Like the corresponding system call, this function opens a pair of connected pipes - see pipe(2). This call is almost always used right before a fork, after which the pipe's reader should close `WRITEHANDLE`, and the writer 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 (output filehandle).

See also the section on "Pipes" in Chapter 6.

3.2.106 package |  | 3.2.108 pop