in reply to batch ping problem
There are a number of errors in your code. For one, you are opening PINGIN inside the loop but only closing it outside the loop. Also your regular expression search when looking throught the log is missing a * so it will never match (it should be "([0-9.]*)" )
Finally I think you've got the case wrong, because ping returns the 64 bytes line when machines are available!
All that aside, there's a much easier way to do what you're trying to do, just use the backtick operator, like this:
That will load the results of the command into an array which you can then process with a single grep command:$ip = "10.32.$octet3.$x"; @data = `ping $ip -w 5`;
print "$ip is not available" if !grep(/^64 bytes from/,@data);
-I went outside... and then I came back in!!!!
In Section Seekers of Perl Wisdom