home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.perl
- Path: sparky!uunet!ftpbox!mothost!merlin.dev.cdx.mot.com!melkur.dev.cdx.mot.com!mcook
- From: mcook@melkur.dev.cdx.mot.com (Michael Cook)
- Subject: Re: What's the difference between `command` and system('command')?
- Message-ID: <mcook.716146751@melkur.dev.cdx.mot.com>
- Sender: news@merlin.dev.cdx.mot.com (USENET News System)
- Nntp-Posting-Host: melkur.dev.cdx.mot.com
- Organization: Motorola Codex, Canton, Massachusetts
- References: <sasswb.716131013@k2>
- Date: Thu, 10 Sep 1992 17:39:11 GMT
- Lines: 25
-
- sasswb@unx.sas.com (Scott Bass) 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?
-
- `foo` captures foo's output. system('foo') doesn't.
-
- To see the difference, try this:
-
- $foo = `echo foo`;
- print "foo=($foo), exit=$?\n";
- $bar = system('echo bar');
- print "bar=($bar), exit=$?\n";
-
- >Finally, what I need to do is export the DISPLAY variable from a PERL script
- >that's submitted via cron. I was just going to give the "export
- >DISPLAY=value" (ksh) command. If there is a better PERL way of doing it,
- >please let me know.
-
- See %ENV in the manual:
-
- $ENV{'DISPLAY'} = 'foo:0.0';
-
- Michael.
-