This subroutine is supposed to chech the validity of an IP address. 4 numbers (1 - 
255) separated by ".".  But my regular expression doesn't seem to be working out for 
me.

print "Enter IP address: ";
chomp($ip = <STDIN>);
&ipcheck($ip);

sub ipcheck{
  if ($_[0] =~ m/([1-2][0..5]*[0..5]*)\.\1\.\1\.\\s*$/) {
        return $_[0];
        } else {
                print "Incorrect IP address format.\n\n";
                exit;
        }
}



_____________________________________________________________
Surf on! Get a free and secure email account and more @ surfOrbit.com
http://www.surfOrbit.com

_____________________________________________________________
Promote your group and strengthen ties to your members with [EMAIL PROTECTED] by 
Everyone.net  http://www.everyone.net/?btn=tag

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to