in reply to Reading from STDOUT after Redirecting it.
use strict; use warnings; my $cmd = 'd:\clwhois.exe'; my $ip = '192.168.1.1'; my $file = 'd:\temp\output.txt'; open(STDOUT, ">$file") or die "Can't open $file: $!\n"; # redirect STD +OUT to a temp file system ("$cmd $ip") and warn "Can not execute $cmd: $!\n"; close STDOUT; open(FILE, "$file") or die "Can't open $file: $!\n"; while (<FILE>){ print; } close STDOUT;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Reading from STDOUT after Redirecting it.
by Dru (Hermit) on Jul 03, 2003 at 00:02 UTC |