http://www.perlmonks.org?node_id=998271


in reply to Read network configuration on FreeBSD

Actually, it doesn't work on Linux, too.

Notice the difference: the interfaces you get are strings, the ones you need are IO::Interface::Simple objects:

use Data::Dumper; use IO::Socket; use IO::Interface::Simple; print Dumper [ IO::Socket::INET::->new(Proto => 'udp')->if_list ]; print Dumper [ IO::Interface::Simple::->interfaces ]; print [IO::Interface::Simple::->interfaces]->[0]->address; __END__ $VAR1 = [ 'eth0', 'lo', 'teredo' ]; $VAR1 = [ bless( { 'name' => 'lo', 's' => bless( \*Symbol::GEN1, 'IO::Socket::INET' ) }, 'IO::Interface::Simple' ), bless( { 'name' => 'eth0', 's' => $VAR1->[0]{'s'} }, 'IO::Interface::Simple' ), bless( { 'name' => 'teredo', 's' => $VAR1->[0]{'s'} }, 'IO::Interface::Simple' ) ]; 127.0.0.1

Sorry if my advice was wrong.