in reply to Finding a machine's name?

One way, my $hostname = `/bin/hostname`; Given that, you can call gethostbyname to get more information.

If you're in a shell environment, you're likely to have the purely perlish,

my ($name, $aliases, $addrtype, $length, @addrs) = gethostbyname $ENV{'HOSTNAME'};
That will probably be available in the cgi environment, too, but probably not in cron.

After Compline,
Zaxo

Replies are listed 'Best First'.
Re^2: Finding a machine's name?
by terra incognita (Pilgrim) on Sep 28, 2004 at 14:36 UTC
    This method also works in Windows by skipping the /bin/
    my $host = `hostname`;
Re^2: Finding a machine's name?
by Red_Dragon (Beadle) on Sep 28, 2004 at 14:47 UTC
    Many thanks for the thorough example