in reply to Make my script faster and more efficient
Consider this:
while (<INPUT2>) { $_ =~ s/[\r\n]+\z//s; # I don't use chomp, sorry my ( $bioC, $contig_id, $pip ) = split( "\t", $_ ); my $origin = $origins{$contig_id}; print RESULTS "$bioC\t$origin\t$pip\n"; }
Update: you could also DIE with an error message in the event that the file contained a code that wasn't in your mapping table:
my $origin = $origins{$contig_id}; if ( ! defined( $origin ) ) { die( "No mapping for \"$contig_id\" found in origins table" ); }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Make my script faster and more efficient
by BrowserUk (Patriarch) on Dec 03, 2008 at 03:51 UTC | |
by quester (Vicar) on Dec 03, 2008 at 06:07 UTC | |
by gone2015 (Deacon) on Dec 03, 2008 at 13:28 UTC |