This page last modified: Nov 01 2005
This code is an infinite loop. fetchrow_hashref() returns a hashref. However, the code is taking the return value as an array. Because the assignment incorrectly uses an array, the while() statement will always be true. # wrong, bad, infinite loop while((my $hr) = $sth->fetchrow_hashref()) { push(@da_list, $hr); } # Correct, performs as expected. The while() turns false when # fetchrow_hashref() doesn't return a value; while(my $hr = $sth->fetchrow_hashref()) { push(@da_list, $hr); } Certain simple syntax errors will really mess up Perl compilation. Large numbers of errors will be reported for lines that don't have errors. In some cases the true error is near the end of the list of errors. In some cases, the true error won't be reported. Here are a few examples. # Missing "sub" on a subroutine. name { # code here } # Space after a variable, or accidently in the middle of a variable name. $var _flag = 1; Missing ; Missing ) # No syntax error for misplaced () if (length($var < 0))