in reply to Net::Netmask not working with scalar variable

@MYIP0=(@MYIP0,@split0);

That is usually written as:

push @MYIP0, @split0;

And also:

if(/IP Address/) { @split0= split(/ /, $_); @MYIP0=(@MYIP0,@split0); }

Can be simplified to:

if(/IP Address/) { push @MYIP0, split; }


if(/\b\d*\.\d*\.\d*\.\d*/)

Your pattern will match the string "..." or "9999.9999.9999.9999" which are not valid IP addresses.


Replies are listed 'Best First'.
Re^2: Net::Netmask not working with scalar variable
by sagarkha (Acolyte) on Oct 12, 2010 at 01:01 UTC
    Thanks jwkrahn, for all these suggestion, i will try to use these methods in my future scripts, this will reduce the line code.