Hi, I have tried putting print $OUT1 "$_\n" for @data1; as what netwallah suggested. It is able to print the output I want. But in the command line, it shows:
Processing data... Original.txt Writing output...Use of uninitialized value $metabolite[44] in string +at G:\Metabolomics\Programming\PERL\Ratio Test\ratio test (update +d 12 feb 1 4).pl line 101, <CURINFILE> line 1 (#1) (W uninitialized) An undefined value was used as if it were alread +y defined. It was interpreted as a "" or a 0, but maybe it was a mi +stake. To suppress this warning assign a defined value to your variables. To help you figure out what was undefined, perl will try to tell y +ou the name of the variable (if any) that was undefined. In some cases it + cannot do this, so it also tells you what operation you used the undefine +d value in. Note, however, that perl optimizes your program and the opera +tion displayed in the warning may not necessarily appear literally in y +our program. For example, "that $foo" is usually optimized into "that + " . $foo, and the warning will refer to the concatenation (.) operat +or, even though there is no . in your program. Writing output...Uncaught exception from user code: Error couldn't create new Directory at G:\Metabolomics\Program +ming\PERL\ Ratio Test\ratio test (updated 12 feb 14).pl line 98, <CURINFILE> line + 2. at G:\Metabolomics\Programming\PERL\Ratio Test\ratio test (updated 12 + feb 14).p l line 98 Press any key to continue . . .
is it some kind of error? In addition, how do I actually loop from dataR1 to dataR3 to put into different arrays instead of having to type out manually as different files has different number of dataRx. I know it has something to do with this line: =~ /_data(\d+)R/ somewhere in the code but I have no idea how.
push(@data1, $columns[1]); push(@data2, $columns[2]); push(@data3, $columns[3]);
into something like this after finding the /_dataS(\d+)R/ in the column headers:
push (@data[j], $columns[j]);
I appreciate if there is any link related to that that can push me to the right direction. :) Thanks for the help by the way!

In reply to Re: How to add column into array from delimited tab file by hellohello1
in thread How to add column into array from delimited tab file by hellohello1

Title:
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, details, 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, summary, 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.