Use lexical file handles, three parameter open and test the result of open:
open my $log, '>', $logfile or die "Failed to create $logfile: $!\n";
Hashes and arrays are born empty so there is no need to explicitly flush them with my %hits = (); (for example). A simple my %hits; gets the job done and results in less clutter.
Use Perl loops. They are easier to understand and are less error prone than C style for loops. Instead of:
for (my $round = 1; $round <= $roundlimit; $round++) {
use:
for my $round (1 .. $roundlimit) {
and instead of monkeying around with the loop counter to exit the loop simply use last:
if ($hitcount == 0) { print $log "Hitcount: $hitcount through Round $round ==> S +TOP\n"; last; }
Don't worry about the files getting closed. The lexical file handles going out of scope will take care of that for you.
In reply to Re: Iterative BLAST(N) program
by GrandFather
in thread Iterative BLAST(N) program
by Tjuh
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |