$ perl 1140691.pl
Use of uninitialized value $2 in concatenation (.) or string at 1140691.pl line 8.
Use of uninitialized value $4 in concatenation (.) or string at 1140691.pl line 9.
hostname : localhost
IP : inet 10.5.50.27 netmask 0xffffff00 broadcast 10.5.50.255
Netmask : inet 10.5.50.27 netmask 0xffffff00 broadcast 10.5.50.255
####
#!/usr/bin/perl
use strict;
use warnings;
chomp(my $syshost = `hostname`);
chomp(my $sysip = `ifconfig | grep -i inet | egrep -v "inet6|127.0.0.1" | head -n 1 | awk '{print \$2}'`);
chomp(my $sysnm = `ifconfig | grep -i inet | egrep -v "inet6|127.0.0.1" | head -n 1 | awk '{print \$4}'`);
print "hostname : $syshost\n";
print "IP : $sysip\n";
print "Netmask : $sysnm\n";
__END__
####
$ perl 1140691.pl
hostname : localhost
IP : 10.5.50.27
Netmask : 0xffffff00
$