while (my $row = $sth->fetchrow_hashref){ print("name = $row->{Name} contact = $row->{Contact}". "\n"); }