This is running on Linux.
$ip = 'www.perlmonks.org';
$ping = `ping -c 3 $ip`;
@times = $ping =~ /time=(\d+\.\d+)/;
@times = sort { $b <=> $a } @times;
print "High to low @times ms\n";
print "Highest $times[0] ms\n";
print "Lowest $times[-1] ms\n";
print "This was the reply parsed\n$ping\n";
And here are the results.
High to low 87.719 ms
Highest 87.719 ms
Lowest 87.719 ms
This was the reply parsed
PING www.perlmonks.org (206.170.14.76) from 207.16.70.63 : 56(84) byte
+s of data.
64 bytes from yoda.blockstackers.com (206.170.14.76): icmp_seq=0 ttl=2
+38 time=87.719 msec
64 bytes from yoda.blockstackers.com (206.170.14.76): icmp_seq=1 ttl=2
+38 time=81.823 msec
64 bytes from yoda.blockstackers.com (206.170.14.76): icmp_seq=2 ttl=2
+38 time=82.001 msec
--- www.perlmonks.org ping statistics ---
3 packets transmitted, 3 packets received, 0% packet loss
round-trip min/avg/max/mdev = 81.823/83.847/87.719/2.758 ms
It's not giving me the right data in the highest, lowest and highest to lowest. Please help.
Thanks
qball~"I have node idea?!"