in reply to Perl DBI problem

You forgot the semi-colon after the $sth->execute() and it is being interpreted as used for the while(). Probably.