Oh in the Do_SQL example, you better omit the line EXIT if you still want the perl script continue to run.
Please also take a look at
http://www.perl.com/pub/q/functionlist
for function die() and eval().
Here's an example from perlfunc page of die():
eval { ... };
die unless $@ =~ /Expected exception/;