#!/usr/bin/perl use Socket; use strict; sub ShowIPLocalInfo { my @hostent = gethostbyname(undef) or return 0; print "name: ",shift @hostent,"\n"; # the name print "alias: ",shift @hostent,"\n"; # not always available print "addrtype: ",shift @hostent,"\n"; print "length: ",shift @hostent,"\n"; print "\nOwn Ip-Addresses:\r\n"; print "\t",inet_ntoa($_), "\n" foreach (@hostent); } ShowIPLocalInfo();