while(my $line = ) { if($line =~ m!RTTs of replies in ms: min/avg/max: \d\.\d* / (\d\.\d*) / \d\.\d*!) { print "avg: " . $1 . "\n"; } }