You should look into exception handling. You would throw and exception at the point of the error (in getparam), and then catch it in a catch block defined in your main loop.
You could fake it with eval/die, but I would recommend looking at the Error module on CPAN.
-pete
"Worry is like a rocking chair. It gives you something to do, but it doesn't get you anywhere."