It probably is to late now, but you should at least consider a module such as IO::Prompt::Hooked. It does all the looping for you. All you provide is the messages and a callback to validate the response.
Bill
Comment on Re: Ask user to enter IP address repitatively for entities like Netmask, Gateway, DNS, bonds etc till correct address entered