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


in reply to List all network interfaces on the local machine?

To find the mac addresses of active network interface cards on the current machine, you can use the (non-standard) Net::Interface module:
use Net::Interface qw( mac_bin2hex ); my @all_ifs = Net::Interface->interfaces; print "Mac addresses of ethernet interfaces on this machine:\n"; for ( grep { $_->name =~ m/^eth\d/ } @all_ifs ) { print mac_bin2hex( scalar $_->hwaddress ),"\n"; }