tobold.org

correct • elegant • free

△ comp.lang.perl △

◅ Q: Input / Ouput buffering and pipes

GDBM, Solaris, and flock/fcntl ▻

Pipe information from one Perl program to another

In article <4lfiub$65g@nms.telepost.no>,
Jahn Otto Andersen <jotto@mediascience.no> wrote:
>How can I start a perl program from another perl program and pipe
>information to the new program ?

There's More Than One Way To Do It, but something like this is the most
straightforward.

    $prog = '/path/to/prog';
    open PROG, "| $prog" or
            die "$0: can't open pipe to $prog: $!\n";

Output to filehandle PROG (e.g. with `print PROG ...') will be sent to
prog's stdin.

Tim.
--
Tim Goodwin   | "Python is an object-oriented language that can
UUNET|PIPEX   | process text; Perl is a text-processing language
Cambridge, UK | that can orient objects. :-)" -- Larry Wall

Original headers:

From: tim@pipex.net (Tim Goodwin)
Newsgroups: comp.lang.perl.misc
Subject: Re: Pipe information from one Perl program to another
Date: 23 Apr 1996 11:11:54 GMT
Organization: Unipalm PIPEX
Message-ID: <4lidtq$sio@wave.news.pipex.net>
References: <4lfiub$65g@nms.telepost.no>

△ comp.lang.perl △

◅ Q: Input / Ouput buffering and pipes

GDBM, Solaris, and flock/fcntl ▻