[Buffalo-pm] Question: How to iterate through 2 arrays and merge columns

Shankar, Ganesh Ganesh.Shankar at RoswellPark.org
Mon Jul 4 12:33:11 PDT 2005


Hello All,

I'm learning perl to process microarray data and mostly I've found it
very useful.  However, I've come to a problem that I haven't been able
to solve.

Background:  One experiment generates two raw (tab-delimited)data files.
 The order of the lines in both these files are identical.  I need to
grab 4 columns from each file and horizontally merge them in the
resulting results file.

I've opened,read,split and pushed the elements into two arrays in their
own foreach loops.

push(our @red_elements,
($red_items[6], "\t", $red_items[7], "\t",
$red_items[8], "\t", $red_items[9], "\n"
)
);
}    #end foreach my $red_line

push(our @green_elements,
($green_items[6], "\t", $green_items[7], "\t",
green_items[8], "\t", $green_items[9], "\n"
)
);
}    #end foreach my $red_line

What I need in the final file is :

($red_items[6], "\t", $red_items[7], "\t",
$red_items[8], "\t", $red_items[9], "\t",
$green_items[6], "\t", $green_items[7], "\t",
green_items[8], "\t", $green_items[9], "\n"

How do I iterate through two arrays at once?  I've tried the Array::Each
module, but I couldn't extend the example in the synopsis to multiple
columns. 

Thanks for any help.

-Ganesh


This email message may contain legally privileged and/or confidential information.  If you are not the intended recipient(s), or the employee or agent responsible for the delivery of this message to the intended recipient(s), you are hereby notified that any disclosure, copying, distribution, or use of this email message is prohibited.  If you have received this message in error, please notify the sender immediately by e-mail and delete this email message from your computer. Thank you.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/ms-tnef
Size: 3052 bytes
Desc: not available
Url : http://mail.pm.org/pipermail/buffalo-pm/attachments/20050704/cc445547/attachment.bin


More information about the Buffalo-pm mailing list