Well depending on your OS there are a couple of ways you can do this. If it is a *nix machine you can do smoething like.
open (READ, "ifconfig fxp0 |") or die "$!";
while (<READ>) {
chomp;
if (/ether/) {
s/^\s+//;
my $mac = (split)[1];
}
}
close READ;
I haven't tested this code, but I am pretty sure that would do it. And if it is an NT machine you would just do something similar with ipconfig instead. Note you should replace fxp0 with the name of your network device.
Update: I just tested the code and it worked.