in reply to Forgot variable syntax for $var = funct() or "Funct failed\n" / Any experience with is_hostname()

A read through Operator Precedence and Associativity in perlop would probably be informative. You have used the low-precedence or instead of the high-precedence ||. Alternatively, you can always use parentheses.
my $hostname = gethostbyaddr(inet_aton($data[$ip_address_pos]), AF_INET) || "Can't resolve $data[$ip_address_pos]: $!\n"; my $hostname = (gethostbyaddr(inet_aton($data[$ip_address_pos]), AF_INET) or "Can't resolve $data[$ip_address_pos]: $!\n" );

#11929 First ask yourself `How would I do this without a computer?' Then have the computer do it the same way.

  • Comment on Re: Forgot variable syntax for $var = funct() or "Funct failed\n";
  • Download Code