in reply to Is it appropriate to handle errors through a subroutine?

smturner1:

Putting error handling code in a subroutine is fine, and can help reduce code replication.

The last two elsifs aren't matching because $old_ip and $new_ip aren't equal to regular expressions--they're (presumably) strings. If you change the 'eq' into '=~' though, the code will see if the $old_ip and $new_ip match those regular expressions. ;^)

...roboticus

When your only tool is a hammer, all problems look like your thumb.

  • Comment on Re: Is it appropriate to handle errors through a subroutine?