home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.perl
- Path: sparky!uunet!stanford.edu!leland.Stanford.EDU!schemers
- From: schemers@leland.Stanford.EDU (Roland Schemers)
- Subject: Re: Process question...
- Message-ID: <1992Jul23.030645.16675@leland.Stanford.EDU>
- Sender: schemers@slapshot.stanford.eu
- Organization: Distributed Computing Group, Stanford University
- References: <1992Jul22.231637.23043@cs.unca.edu>
- Date: Thu, 23 Jul 92 03:06:45 GMT
- Lines: 24
-
- In article <1992Jul22.231637.23043@cs.unca.edu> mcmahan@cs.unca.edu (Scott McMahan -- Genesis mailing list owner) writes:
- >
- >fork a process that will exec 'sort'
- >parent feeds sort a bunch of words, and reads sort's output for use later.
- >
-
- #!/usr/local/bin/perl
- require 'open2.pl';
-
- $pid = &open2("OUTPUT","INPUT","/usr/bin/sort");
-
- @word=("just","another","perl","hack");
-
- foreach(@word) { print INPUT "$_\n"; }
-
- close(INPUT);
-
- while(<OUTPUT>) { print "$_"; }
-
- --
- Roland J. Schemers III | Networking Systems
- Systems Programmer | 168 Pine Hall (415)-723-6740
- Distributed Computing Group | Stanford, CA 94305-4122
- Stanford University | schemers@Slapshot.Stanford.EDU
-