home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.perl
- Path: sparky!uunet!s5!is1.is.morgan.com!is.morgan.com!robt
- From: robt@is.morgan.com (Rob Torop)
- Subject: Re: What's the difference between `command` and system('command')?
- Message-ID: <1992Sep11.161827@is.morgan.com>
- Sender: news@is.morgan.com
- Nntp-Posting-Host: idt101
- Organization: Morgan Stanley - IS
- References: <sasswb.716131013@k2> <1992Sep10.183530.21405@news.eng.convex.com> <peter.716216984@merlin>
- Date: Fri, 11 Sep 1992 20:18:27 GMT
- Lines: 27
-
- In article <peter.716216984@merlin>, peter@merlin.acadiau.ca (Peter Steele) writes:
- |> >:What the difference between saying `some Unix command` and
- |> >:system('some Unix command')? Are they synonymous? Are there situations
- |> >:where one is better than the other?
- |>
- |> > `cmd`;
- |> > $line = `cmd`;
- |> > @lines = `cmd`;
- |>
- |> >returns the output, as it does in the shell. The first form,
- |> >however, throws it away. system() works much (although not
- |> >quite exactly) as it does in C.
- |>
- |> Where does error output go (i.e., stderr)? I have an application
- |> where I want to capture error output, not stdout.
-
- How about
-
- @lines = `cmd 2>&1`;
-
- This runs cmd with stderr redirected to stdout. It works with ksh - I don't know about csh.q
-
- -- Rob Torop
-
- +---------------------------------------------------------------------+
- | The views expressed here are neither mine nor those of my employer. |
- +---------------------------------------------------------------------+
-