Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

STDOUT redirection

Status
Not open for further replies.

caitsdeo

Programmer
May 25, 1999
17
0
0
US
I'm running a system remote shell command from a perl script that puts the output to STDOUT. I want to redirect the output to a variable for this one command only. How do I do that?
 
Instead of using a system command try using a pipe, like so:

open PIPE, "cmd |" or die "Cannot open pipe : $!\n";
my @lines = <PIPE>;
close PIPE;

Barbie
Leader of Birmingham Perl Mongers
 
The PIPE works great. I never would have known that. Thank you so much.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top