in reply to Validating IP Address

        is there any better way to do this??

Yes there is : Use Regexp::Common

use Regexp::Common qw /net/; /^$RE{net}{IPv4}$/; # Results in $1 .. $5 .. Please RTFM for details.

     "An undefined problem has an infinite number of solutions." - Robert A. Humphrey         "If you're not part of the solution, you're part of the precipitate." - Henry J. Tillman