While I've come to this discussion somewhat late, if you are wanting a more cross platform solution (as opposed to parsing the output of an external command such as
ifconfig), you may wish to consider the employ of the most recent version of
Net::Pcap (and the corresponding libpcap library) - With the most recent version of this module (0.05), a list of all network devices that can be used fornetwork monitoring can be retrieved using the
findalldevs function:
my @devs = Net::Pcap::findalldevs( \( my $err = undef ) )
perl -le "print unpack'N', pack'B32', '00000000000000000000001011101000'"