perlquestion
bwelch
Fellow monks,<br>
In a function that reads several million rows from a database, I'm finding it is taking a very long time to complete. I recently added <i>use warnings;</i> to the script and am now seeing this message many times in the log:
<p> "Use of uninitialized value in concatenation (.) or string at cf.pl line xxx"
<p>
I'm not seeing what is not initialized here. Do you?
<p>
Since this is taking a long time to complete, could you recommend any optimizations?
thanks,
Bryan
<code>
use strict;
use warnings; # Added this line in last run
sub build4PartFastaFile
{
&addDateStamp;
my ( $fileToMake, $dbCommand ) = @_;
open( FILE, ">$fileToMake" ) or die print "Can't open fileToMake: $!";
my $sth2 = $dbh->prepare( $dbCommand ) or die print LOG "Can't prepare: $! OR $DBI::errstr";
$sth2->execute or die print LOG "Can't execute: $! OR $DBI::errstr";
while ( ( my $giName, my $gssName, my $definition, my $sequence ) = $sth2->fetchrow_array )
{
$sequence = uc( $sequence );
$sequence =~ s/(\S{1,80})/$1\n/g;
print FILE ">$giName $gssName $definition\n$sequence";
}
close( FILE );
}
</code>