my $refseq_list ="/home/bla/bla/refseq.txt"; open(REF,$refseq_list); my($ref,@ref,$size,$command1); while($ref=) { push(@ref,$ref); } $size = @ref; print "$size sequences found\n"; my $count=0; LOOP:foreach $ref(@ref) { print "in foreach loop\n"; $count=0; $command1 = qq{select tax_id from gene2acc where genomic_ac_ver= '$ref'; }; $sth1=$dbh->prepare($command1); $sth1->execute() or die $sth1->errstr; my($tax_id); $sth1->bind_columns(undef,\$tax_id ); while($array=$sth1->fetchrow_array()) { $count++; if($sth1->rows == 0) { print "No records matched for $ref\nn"; } elsif($count==1) { $t=$array; print "Entering taxID_format with $t\n"; #&taxID_format($t); } }