On Friday, November 1, 2019 1:49:31 AM CET Maggie Q Roth wrote:
> If Net::Ping gets failure and has the special statement for the failure,
> how can return this statement to the caller?

The ping() method never fails, see https://metacpan.org/pod/Net::Ping .  
Return returns by returning, like this:


sub pongping {
  return Net::Ping->new()->ping(shift);
}


my $statement = pongping('example.com');
if(defined($statement)) {
  printf("%s\n", $statement ? 'pong' : 'unreached');
} else {
  print "invalid ping target\n";
}

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to