while(fetchrow_hashref) {print qq($data->{field1}\n); #### while(fetchrow_hashref) { print qq($data->{field1}; # pseudocode to use $data->{field1} in another query, run query, another while(fetchrow_hashref) to print out the results of the second query then... # end original while loop }