<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xml:base="http://community.activestate.com" xmlns:dc="http://purl.org/dc/elements/1.1/">
<channel>
 <title>ActiveState Community Site - spliting a table into individual columns - Comments</title>
 <link>http://community.activestate.com/forum-topic/spliting-table-individual-columns</link>
 <description>Comments for &quot;spliting a table into individual columns&quot;</description>
 <language>en</language>
<item>
 <title>spliting a table into individual columns</title>
 <link>http://community.activestate.com/forum-topic/spliting-table-individual-columns</link>
 <description>&lt;p&gt;H!&lt;br /&gt;
it&#039;s my first message, and i&#039;m a total beginner. I&#039;m trying to split a table into individual columns (and i think i&#039;ve done it) but how go i extract the data from the individual column and/or search them for certain data, like type?  &lt;/p&gt;
&lt;p&gt;use warnings;&lt;br /&gt;
use strict;&lt;/p&gt;
&lt;p&gt;sub read_TABLE{&lt;br /&gt;
  my($file_name)=@_;&lt;br /&gt;
  open (OPEN_TABLE,$file_name);&lt;br /&gt;
if(open (OPEN_TABLE, $file_name)){&lt;br /&gt;
 print &quot;Can open file \&quot;$file_name\&quot; \n&quot;;&lt;br /&gt;
}&lt;br /&gt;
  unless(open(OPEN_TABLE, $file_name)){&lt;br /&gt;
  print STDERR  &quot;Can&#039;t open file \&quot;$file_name\&quot; \n&quot;;&lt;br /&gt;
}&lt;br /&gt;
  my@table;&lt;br /&gt;
  while(my$line=){&lt;br /&gt;
    chomp$line;&lt;br /&gt;
    my@data=split(/\t/,$line,5);&lt;br /&gt;
    push@table,\@data;&lt;/p&gt;
&lt;p&gt;  }&lt;br /&gt;
close OPEN_TABLE;&lt;br /&gt;
return @table;&lt;br /&gt;
}&lt;br /&gt;
my@s=&amp;amp;read_table(&quot;TABLE.txt&quot;);&lt;/p&gt;
&lt;p&gt;foreach my$line(@s) {&lt;br /&gt;
  my$start=[0];&lt;br /&gt;
  my$end=[1];&lt;br /&gt;
  my$name=[2];&lt;br /&gt;
  my$strand=[3];&lt;br /&gt;
  my$type=[4];&lt;br /&gt;
print &quot;$type\n&quot;;&lt;br /&gt;
}&lt;/p&gt;
&lt;p&gt;one of the columns has tells me whether it&#039;s a promoter (DNA data). i want to fish out all &quot;promoters&quot;, match them to the name and sequence start and end description  other columns so i can fish out the sequence from different file.&lt;br /&gt;
can you help?&lt;br /&gt;
also when i run it i get:&lt;/p&gt;
&lt;p&gt;Can open file &quot;TABLE.txt&quot;&lt;br /&gt;
ARRAY(0x181ea88)&lt;br /&gt;
ARRAY(0x181ea88)&lt;br /&gt;
ARRAY(0x181ea88)&lt;br /&gt;
ARRAY(0x181ea88)&lt;br /&gt;
ARRAY(0x181ea88)&lt;br /&gt;
.....&lt;br /&gt;
ARRAY(0x181ea88)&lt;/p&gt;
&lt;p&gt;what does it mean?? it looks like some sort of reference??&lt;/p&gt;
&lt;p&gt;actually i&#039;ve just tested whether it&#039;s a reference with&lt;/p&gt;
&lt;p&gt;print &quot;@$type\n&quot;;&lt;/p&gt;
&lt;p&gt;and yes, i get Can open file &quot;TABLE.txt&quot;&lt;br /&gt;
4&lt;br /&gt;
4&lt;br /&gt;
4&lt;br /&gt;
4&lt;br /&gt;
etc&lt;/p&gt;
&lt;p&gt;which means that i created a column called &quot;type&quot; full of 4s rather then an array of data from 5th column arrrrrrr&lt;/p&gt;
&lt;p&gt;Thank a million&lt;br /&gt;
x&lt;/p&gt;
</description>
 <comments>http://community.activestate.com/forum-topic/spliting-table-individual-columns#comments</comments>
 <category domain="http://community.activestate.com/forums/perl-discussion-0">Perl discussion</category>
 <category domain="http://community.activestate.com/os/os-x">OS X</category>
 <pubDate>Wed, 19 Dec 2007 19:04:21 -0800</pubDate>
 <dc:creator>C_elegance</dc:creator>
 <guid isPermaLink="false">1738 at http://community.activestate.com</guid>
</item>
</channel>
</rss>
