Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

comment on

( [id://3333] : superdoc . print w/replies, xml ) Need Help??
Fellow monks,
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 use warnings; to the script and am now seeing this message many times in the log:

"Use of uninitialized value in concatenation (.) or string at cf.pl line xxx"

I'm not seeing what is not initialized here. Do you?

Since this is taking a long time to complete, could you recommend any optimizations? thanks, Bryan

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 prepa +re: $! 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 ); }

In reply to Finding error: uninitialized value in concatenation? by bwelch

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.