On Mon, 2008-04-07 at 10:26 -0500, Kevin Viel wrote:
> On my Solaris box, I have a perl program that calls a second program via
> !system:
>
> my $sys = !system "phymap" ;
Actually this statement is read as:
my $sys = ! (system "phymap");
The NOT operator is applied to returned value of the system function.
>
> The results of phymap my be several lines of text. I would like to process
> these lines in perl, but since the parent waits for the child
> it does not appear that I can "feed" them to STDIN. I could write them to a
> temporary file, read them after the child process has returned control to
> the perl program, and then delete them, but it seems like I might find a
> "better" way. I would appreciate any suggestions or references.
What you want is a pipe from phymap to STDIN. See `perldoc -f open` for
details.
open my $phymap_fh, '-|', "phymap" or die "cannot open pipe from
phymap: $!";
my @phymap = <$phymap_fh>; # slurp the entire output
close $phymap_fh or die "error on closing pipe from phymap: $!";
--
Just my 0.00000002 million dollars worth,
Shawn
99% of you are just big dumb apes!
+------------\
| Shangri La \
| 40,000 KM /
+------------/
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/