home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.perl
- Path: sparky!uunet!ftpbox!mothost!merlin.dev.cdx.mot.com!fendahl.dev.cdx.mot.com!mcook
- From: mcook@fendahl.dev.cdx.mot.com (Michael Cook)
- Subject: Re: Simultaneous processes
- Message-ID: <mcook.714854903@fendahl.dev.cdx.mot.com>
- Sender: news@merlin.dev.cdx.mot.com (USENET News System)
- Nntp-Posting-Host: fendahl.dev.cdx.mot.com
- Organization: Motorola Codex, Canton, Massachusetts
- References: <root.714838821@merlin>
- Date: Wed, 26 Aug 1992 18:48:23 GMT
- Lines: 34
-
- peter@merlin.acadiau.ca (Peter Steele) writes:
-
- >How does one set up simultaneous processes in perl? For example,
- >how would I translate the following into perl:
-
- > #!/bin/sh
-
- > ls -la > d1 &
- > ls -la > d2 &
- > ls -la > d3 &
- > wait
- > cat d1 d2 d3 > d4
-
- ...
-
- > wait for all processes to complete and combine output;
-
- It would probably be enough to wait for them in the order they were started.
- For example, here's the logic from a script I use run parallel rsh's:
-
- foreach $host (@host)
- {
- open($host, "rsh $host $command |") || die "popen";
- }
- foreach $host (@host)
- {
- while (<$host>)
- {
- &do_something_with($_);
- }
- close($host);
- }
-
- Michael.
-