#!/usr/bin/perl -w # # Test script voor interface informatie # by Djeezus 30/04/2004 # ------------------------------------- use IO::Interface; use IO::Socket::INET ; # must create socket first, bound to all interfaces $sock = IO::Socket::INET->new(Proto => 'udp'); # get list of active interfaces @iflist = $sock->if_list; print "List interfaces : @iflist\n"; # get list of active interfaces/addresses for $intf (@iflist) { $addr = $sock->if_addr(${intf}); # creating hash interface/address $addrlist{"$intf"} = "$addr"; } # all active interface/ipaddress # using 'key' => 'value' from created hash while (($key,$value) = each %addrlist ) { print "$key\t=>\t$value\n" }