You forgot the semi-colon after the $sth->execute() and it is being interpreted as used for the while(). Probably.
In reply to Re: Perl DBI problem by diotalevi in thread Perl DBI problem by matth