//query number 1 $current_resume=$result->{'CustomerID'}; // or the like open (FILE,">>$current_resume"); // open the file based on the current user in APPEND MODE print FILE $header_information; // title and so on print FILE $query_one_data; close FILE; //IF NECESSARY //query number 2 open (FILE,">>$current_resume"); //IF CLOSED previously. print FILE $query_two_data; close FILE; // etc... for as many queries that you need.