home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!wupost!usc!news!netlabs!lwall
- From: lwall@netlabs.com (Larry Wall)
- Newsgroups: comp.lang.perl
- Subject: Re: system & exec questions
- Message-ID: <1992Aug25.225237.11362@netlabs.com>
- Date: 25 Aug 92 22:52:37 GMT
- References: <1992Aug20.234826.28608@csus.edu>
- Sender: news@netlabs.com
- Organization: NetLabs, Inc.
- Lines: 20
- Nntp-Posting-Host: scalpel.netlabs.com
-
- In article <1992Aug20.234826.28608@csus.edu> eburk@sfsuvax1.sfsu.edu (Eli Burk) writes:
- : I am having some difficulty understanding how to use perl
- : system & exec functions. As an example if I have @list
- : and I want to send this out to my system (unix) what is
- : the best wa? As an example I want to use unix "pr"
- : the following is from memory - but it shows the basic idea...
- : csh script fragment (cal 9 1992; cal 10 1992) | pr -t -2
- : How do I acomplish the same thing in perl? If I pass the
- : "cal"s to @list how can I then pipe @list to "pr"?
-
- That is a bit underspecified, but try something like this:
-
- open(INPUT, "cal 9 1992; cal 10 1992|");
- open(OUTPUT, "| pr -t -2");
- @list = <INPUT>;
- print OUTPUT @list;
- close INPUT;
- close OUTPUT;
-
- Larry
-