Hi,
I'm trying to print stdout to a file, then switch back to the default
standard out so that it prints to the screen. This script takes a
list of ip's and does a reverse lookup on them, it then saves the
output to "reverse.txt".
Here's my code:
#!/usr/bin/perl
use strict;
use warnings;
print "Enter the file you want to perform a reverse lookup on:\n";
my $file_open = <STDIN>;
open (STDOUT,">reverse.txt");
open(DEVFILE, "$file_open") or die "Can't open file dude!: $!";
my @dev_ip=<DEVFILE>;
foreach my $ip(@dev_ip) {
system("host -W 1 $ip")
}
close(DEVFILE);
close(STDOUT);
print "Your ouput has been saves as reverse.txt in the
current directory\n"; ###### I want to print this line back to
STDOUT but since I redirected it above with "open
(STDOUT,">reverse.txt") I can't figure out how to.
Thanks,
-phil
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/