in reply to spliting a table into individual columns
Your (incorrect) code should look like this, when posted to this site. This is produced using "code" tags:
use warnings; use strict; sub read_TABLE{ my($file_name)=@_; open (OPEN_TABLE,$file_name); if(open (OPEN_TABLE, $file_name)){ print "Can open file \"$file_name\" \n"; } unless(open(OPEN_TABLE, $file_name)){ print STDERR "Can't open file \"$file_name\" + \n"; } my@table; while(my$line=<OPEN_TABLE>){ chomp $line; my @data=split(/\t/,$line,5); push @table,\@data; } close OPEN_TABLE; return @table; } my @s=read_table("TABLE.txt"); foreach my $line(@s) { my$start=[0]; my$end=[1]; my$name=[2]; my$strand=[3]; my$type=[4]; print "$type\n"; }
"As you get older three things happen. The first is your memory goes, and I can't remember the other two... " - Sir Norman Wisdom
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: spliting a table into individual columns
by Anonymous Monk on Dec 21, 2007 at 02:12 UTC |