Hi, I am having trouble with this: each select statement executed will fetch multiple records with same tax_id(see below) value. I want to catch only single of 'em. some how it not getting in to elsif($count==1) loop. I am unable to figure out why? please let me know,
my $refseq_list ="/home/bla/bla/refseq.txt"; open(REF,$refseq_list); my($ref,@ref,$size,$command1); while($ref=<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= '$r +ef'; }; $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); } }

In reply to dbi retieve single col value by Anonymous Monk

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



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.