I don't have time to try any modules right now (which I'd search out instead of shelling out), but here's a way with less external calls:
#!/usr/bin/perl
use warnings;
use strict;
my $hostname = `hostname`;
my $config = `ifconfig`;
$config =~
m/
inet\saddr:
(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})
.*?
Mask:
(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})
/x;
if ($1 && $2 && $1 !~ /127\.0\.0/){
my $ip = $1;
my $netmask = $2;
print "hostname: $hostname" .
"IP: $ip\n" .
"Netmask: $netmask\n";
}
__END__
hostname: steve-ws
IP: 10.0.48.1
Netmask: 255.255.255.0