in reply to dumb question on exec and system ...

And you can also use the 'open' command to run another command and redirect it's STDOUT. From the 'perlipc' manpage:
Using open() for IPC Perl's basic open() statement can also be used for unidirection +al interprocess communication by either appending or prepending a +pipe symbol to the second argument to open(). Here's how to start s +omething up in a child process you intend to write to: open(SPOOLER, "| cat -v | lpr -h 2>/dev/null") || die "can't fork: $!"; local $SIG{PIPE} = sub { die "spooler pipe broke" }; print SPOOLER "stuff\n"; close SPOOLER || die "bad spool: $! $?"; And here's how to start up a child process you intend to read f +rom: open(STATUS, "netstat -an 2>&1 |") || die "can't fork: $!"; while (<STATUS>) { next if /^(tcp|udp)/; print; } close STATUS || die "bad netstat: $! $?";
For STDIN / STDOUT / STDERR at the same time you could use the IPC::Open3 module:
use IPC::Open3; $pid = open3(\*WTRFH, \*RDRFH, \*ERRFH, 'some cmd and args', 'optarg', ...);
TMTOWTDI

Replies are listed 'Best First'.
Re: Re: dumb question on exec and system ...
by iza (Monk) on Apr 16, 2004 at 08:57 UTC
    Thanks for the reply - i had read about that one in the doc too ... TMTOWTDI, definitly !!!!