my @ref; while ((@ref)=$sth->fetchrow_array) { print "The name field " . $ref[0]; print "The phone1 field " . $ref[1]; print "The phone2 field " . $ref[2]; }