sagarkha has asked for the wisdom of the Perl Monks concerning the following question:
Below is the subscript of my actual code, $fk is not getting the correct value it seems, though $MYIP1[0] is getting the desired IP.
however when i manually assign IP to $ff, it worksopen(F,'C:\Temp\ipconfig.txt') || die "error($!)"; while(<F>) { if(/IP Address/) { @split0= split(/ /, $_); @MYIP0=(@MYIP0,@split0); } if(/Gateway/) { @split1=split(/ /, $_); @MYGATEWAY0=(@MYGATEWAY0,@split1); } $i++; } foreach(@MYIP0) { if(/\b\d*\.\d*\.\d*\.\d*/) { @MYIP1=(@MYIP1, $_); } } foreach(@MYGATEWAY0) { if(/\b\d*\.\d*\.\d*\.\d*/) { @MYGATEWAY1=(@MYGATEWAY1, $_); } } my $ff="$MYIP1[0]"; my $fk="$ff:255.255.255.0"; $block4 = new2 Net::Netmask($fk); print $block4->size();
my $ff="10.6.10.5"; my $fk="$ff:255.255.255.0"; $block4 = new2 Net::Netmask($fk); print $block4->size();
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Net::Netmask not working with scalar variable
by jwkrahn (Abbot) on Oct 08, 2010 at 06:22 UTC | |
by sagarkha (Acolyte) on Oct 12, 2010 at 01:01 UTC | |
Re: Net::Netmask not working with scalar variable
by CountZero (Bishop) on Oct 08, 2010 at 08:39 UTC | |
Re: Net::Netmask not working with scalar variable
by aquarium (Curate) on Oct 08, 2010 at 04:59 UTC | |
by Anonymous Monk on Oct 10, 2010 at 19:31 UTC | |
by sagarkha (Acolyte) on Oct 12, 2010 at 00:58 UTC | |
Re: Net::Netmask not working with scalar variable
by ig (Vicar) on Oct 08, 2010 at 09:09 UTC | |
Re: Net::Netmask not working with scalar variable
by Anonymous Monk on Oct 08, 2010 at 13:39 UTC |
Back to
Seekers of Perl Wisdom