in reply to Resolving DNS of local network

Glad it seems to be working for you but do take a peek at the source-code of that module's implementation. A Perl program could find itself on an internal network – therefore with a non-public, non-routable IP address – and sometimes that IP does not have a public gateway that it can reach. The internal IP might well not correspond to any external IP address at all. There is no "generalized solution" to this question; sometimes, it cannot be answered.

Replies are listed 'Best First'.
Re^2: Resolving DNS of local network
by thanos1983 (Parson) on Jan 23, 2018 at 15:08 UTC

    Hello IB2017,

    I agree with fellow Monk Anonymous Monk. You could use something like that:

    #!/usr/bin/perl use strict; use warnings; use feature 'say'; use Net::Domain qw( hostfqdn hostdomain ); if (my $hostdomain = hostdomain) { say $hostdomain; } else { my $hostfqdn = hostfqdn; say $hostfqdn; }

    Where you can get use the hostfqdn() method and you can identify and return the FQDN of the current host. By doing so you will get all public information at least. You can read more at the documentation Net::Domain.

    Hope this helps, BR.

    Seeking for Perl wisdom...on the process of learning...not there...yet!