if ($sth->rows > 0) { $next = @{$nextimg}; print "next is $next"; print "next2 is @{$nextimg}"; }