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.

In reply to Re^3: Text File Manipulation by roboticus
in thread Text File Manipulation by sabas

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.