my $output = `echo who | nc host.name port`; if ($output =~ /(\d+\.\d+\.\d+\.\d+)/ and system("ping $1");