Hansenator
Technical User
- Apr 18, 2009
- 2
Hello,
I'm very new to Perl and hope someone can help.
I'm trying to write a program for linux that opens a file, pings the addresses in the file and sends the output to an output file and to the screen.
I searched on the internet and tried it every way I can think of but can't get it to work. This is what I have so far that does work, it will open a file, ping the addresses and send the output to the screen but I can't figure out how to send that same output to another file:
Thanks so much for the help.
I'm very new to Perl and hope someone can help.
I'm trying to write a program for linux that opens a file, pings the addresses in the file and sends the output to an output file and to the screen.
I searched on the internet and tried it every way I can think of but can't get it to work. This is what I have so far that does work, it will open a file, ping the addresses and send the output to the screen but I can't figure out how to send that same output to another file:
Code:
#!/usr/bin/perl
while (defined($line = <>)) {
system ("ping -c 4 $line");
}
Thanks so much for the help.