#!/usr/bin/perl -w use strict; #use Schedule::Cron; use Net::Ifconfig::Wrapper; my $mask=my $ip="0.0.0.0"; # get info for all interfaces my $Info = Net::Ifconfig::Wrapper::Ifconfig('list', '', '', ''); # get info for my interfaces eval { ($ip, $mask) = %{$Info->{"eth0"}{'inet'}}; }; warn $@ if $@; print "net::ifconfig eth0 addr is $ip\n"; #### Can't use an undefined value as a HASH reference at ./test.pl line 15. net::ifconfig eth0 addr is 0.0.0.0 #### net::ifconfig eth0 addr is 192.168.0.1