Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
So far, you’ve seen ways to deal with synchronous processes, where Perl stays in charge, launches a command, (usually) waits for it to finish, then possibly grabs its output. But Perl can also launch a child process that stays alive, communicating[376] to Perl on an ongoing basis until the task is complete.
The syntax for launching a concurrent (parallel) child process is
to put the command as the “filename” for an open call, and either precede or follow the
command with a vertical bar, which is the “pipe” character. For that
reason, this is often called a piped open. In the two-argument form, the pipe
goes before or after the command that you want to run:
open DATE, 'date|' or die "cannot pipe from date: $!"; open MAIL, '|mail merlyn' or die "cannot pipe to mail: $!";