I'd expect that $_ would be assigned during a for or foreach loop, but not during a while loop. Try
push @results, $_ foreach ($sth->fetchrow_hashref());
Update: It's possible to be mislead by
while ( <FILE> ) { ...
Here, $_ does get set. But this is actually due to input operator behavior, as covered in the "I/O Operators" section in perlop.
Props to rob_au for prodding this clarification.
In reply to Re: Having to specify $_
by dws
in thread Having to specify $_
by mt2k
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |