#!/usr/bin/perl chomp($syshost = `hostname`); chomp($sysip = `ifconfig | grep -i inet | egrep -v "inet6|127.0.0.1" | head -n 1 | awk '{print $2}'`); chomp($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"; #### EXPECTED RESULT hostname : laptop.example.com IP : 10.10.50.21 Netmask : 255.255.255.0 RECEIVED RESULT hostname : laptop.example.com IP : inet 10.10.50.21 netmask 255.255.255.0 destination 10.10.50.1 Netmask : inet 10.10.50.21 netmask 255.255.255.0 destination 10.10.50.1