Bootstrap FreeKB - Perl (Scripting) - hostname
Perl (Scripting) - hostname

Updated:   |  Perl (Scripting) articles

This assumes you have installed the Net::Domain module on your system.

Here is the boilerplate code to return the system hostname using Net::Domain.

#!/usr/bin/perl
use strict;
use warnings;
use Net::Domain qw(hostname);
my $hostname = hostname();
print "\$hostname = $hostname";
exit;

 




Did you find this article helpful?

If so, consider buying me a coffee over at Buy Me A Coffee



Comments


Add a Comment


Please enter 32870e in the box below so that we can be sure you are a human.