Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8805585
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T01:54:16+00:00 2026-06-14T01:54:16+00:00

I am doing something wrong here and I don’t know what. This small program

  • 0

I am doing something wrong here and I don’t know what. This small program is supposed to take the 4 IPv4 addresses listed and use hostent’s gethost() to resolve the Domain. If it fails, it keeps the IPv4 format.

Output:

180.76.5.59 has a hostname of 180.76.5.59
199.200.9.44 has a hostname of 199.200.9.44

Then, the error I’m receiving:

 Can't locate object method "137.48.78.181" via package "Net::hostent" at
     ./rev.pl line 19 (#1)
 (F) You called a method correctly, and it correctly indicated a package
 functioning as a class, but that package doesn't define that particular
 method, nor does any of its base classes.  See perlobj.

Uncaught exception from user code:
Can't locate object method "137.48.78.181" via package "Net::hostent" at ./rev.pl line 19.
 at ./rev.pl line 17

17: if ( my $h = gethost($host) ) 19: $name = ($h->$name());

Code:

#!/usr/bin/perl

use Modern::Perl;

use Net::hostent;
use diagnostics;

my @ipaddresses = qw/ 180.76.5.59 199.200.9.44 137.48.78.181 137.48.185.207 /;
#host 137.48.78.181
foreach my $host ( @ipaddresses )
{
  my $name = $host;

  # my @sysArg = ("host", $host);
  # system(@sysArg);

 if ( my $h = gethost($host) )
 {
  $name = ($h->$name());
 }
  print "$host has a hostname of $name\n";
}

You’ll notice I have commented out the system host command, when I use that it works fine but I haven’t thought of a way to capture the Domain (and silence the output).
Any help much appreciated.

when using system(@sysArg); I get this :

Host 59.5.76.180.in-addr.arpa not found: 2(SERVFAIL)
Host 44.9.200.199.in-addr.arpa. not found: 3(NXDOMAIN)
181.78.48.137.in-addr.arpa domain name pointer pc-78-181.hpr.unomaha.edu.
207.185.48.137.in-addr.arpa domain name pointer pki174b-01.ist.unomaha.edu.
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T01:54:17+00:00Added an answer on June 14, 2026 at 1:54 am

    You have a misplaced $ sigil.

    This code:

    $name = ($h->$name());  # WRONG
    

    … should be:

    $name = ($h->name());
    

    Can't locate object method "137.48.78.181" hints at this: the string value of $name was being used as a method name.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I know I'm doing something wrong here, I just don't know what as I'm
How I get the Context? Am I doing something wrong here? This is my
I'm sure that I'm doing something wrong here, but this is what my application
I must be doing something wrong here. I'm trying to use Google Analytics to
I must be doing something wrong here (because really, what are the chances of
I'm hoping I'm doing something wrong here and someone can point me in the
There is probably something dumb I am doing wrong here. public function get_scores($id) {
Perhaps I am doing something wrong while z-normalizing my array. Can someone take a
Unless I am doing something wrong, the way I am supposed to use ConfigurationSection,
I'm not sure if I'm doing something wrong here or not, but I need

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.