in reply to Don't understand row

Update: Damn, There were no replies when I started this post. Now there are 3 before mine! You guys are fast!

AnonyMonk: The error is " Can't call method "rows" on an undefined value at...."
Have you intialized $sth2? The error means you are trying to execute a module call on an object you have not yet created.

You have:
$sth = $dbh_base_app->prepare($sqlstatement);
where you defined $sth....but you don't define $sth2 as an object of $dbh_base_app
You don't tell us which type of database you are interacting with, but the MySql/Perl documentation is here.