
miller
User
Apr 18, 2011, 10:05 AM
Post #2 of 2
(1122 views)
|
Re: [Xploit] writing to a file from perl
[In reply to]
|
Can't Post
|
|
Using select in that way won't work because the output of system is printing to a different STDOUT. Instead either capture the results of your external command using backticks ``, or have the system command append to the file.
#!/usr/bin/perl use warnings; use strict; my @ips = do { open my $fh, 'ips.txt' or die $!; <$fh>; }; chomp @ips; open my $fh, '>>', 'output.txt' or die $!; for (@file) { print $fh `ping -c 1 $_`; } or
for (@file) { system("ping -c 1 $_ >> output.txt"); } - Miller
(This post was edited by miller on Apr 18, 2011, 10:06 AM)
|