in reply to Re^2: Text File Manipulation
in thread Text File Manipulation


Your code is frightening. You need to learn how to read code and understand what's happening inside it. Your code has three different places where you're creating the desired row of data (one which looks just fine) and then you're playing with temporary files in desperate attempts at trying to somehow get the data into the file you want.

It looks like it would work if you'd remove all the junk you don't really need. I was able to cut your code down into something that looks reasonable in less than 40 lines. I'd ordinarily make a long post describing some ways to improve your code, but I don't have the time to do it today. Instead I'll show you the line that looks like it would work (I changed @rows to $rows to eliminate a warning):

$rows[$submit_button] = $file_requesterName . $file_requesterEmail . $ +file_reqtype . $file_region . $file_Serial_Number . $file_aiws_OSS_IP +_pri . $file_aiws_OSS_IP_sec . $file_temp_SGW_IP_pri . $file_temp_SGW +_IP_sec . $file_bts_site_id . $file_req_date . $file_NOC_Update_req . + $file_OSS_enm . $file_category . $file_RNC_Name . $file_submission_ +status . $file_additionalnotes;

Since that line puts the data in the correct format into @rows, you can delete the code dealing with temporary files and just write the @rows data to the output file.


When your only tool is a hammer, all problems look like your thumb.