in reply to Database Blues

It seems that you have "use strict" enabled in your script. Good job.

However, when you "use strict", you need to write code that behaves. Variables used in your script have to either be declared with "my" or explicitly qualified. Put

my($dbh, $sth);
above line 8 in your code, and see what that gives you.

For more information, do

perldoc strict