in reply to Create a map from multiple ping output
Untested.#!/usr/bin/perl use strict; use warnings; my @hosts=("8.8.8.8","8.8.4.4"); for my $h (@hosts){ my $command = "ping -c 3 $h"; for(qx/$command/){ next unless m{rtt min/avg/max/mdev = "}; my @v= m{([\d\.]+)[/\s]}g; print "$h min:$v[0] avg:$v[1] max:$v[2] mdev:$v[3]\n"; last; } $? and print "ERROR:Ping to $h failed err:" , $?>>8,"\n"; }
"Imaginary friends are a sign of a mental disorder if they cause distress, including antisocial behavior. Religion frequently meets that description"
|
|---|