Thanks so much for your reply stajich.

Indeed the module is very very useful.
However I find a problem while extending the usage. Perhaps you can give some advice.

Suppose I am taking a file as input (the content of the file is similar to my OP), and wish to process that file in *multiple trials*. So I have the following code.
#!/usr/bin/perl -w use strict; use Bio::SeqIO; my $file = $ARGV[0]; open INFILE, "<$file" or die "$0: Can't open file $file: $!"; for (my $trial = 1; $trial <=2; $trial++) { seek(INFILE,0,0); #This is line 10 print "Trial $trial\n"; my $i =1; my $in = Bio::SeqIO->new(-format => 'fasta', -fh => \*INFILE); while( my $seq = $in->next_seq ) { print $i++, " : ", $seq->seq(), "\n"; } }
The my code above (especially in Bio::SeqIO method) encounter this warning while arriving at second trial.
Trial 1 1 : TGCAATCACTAGCAAGCTCTCGCTGCCGTCACTAGCCTGTGG 2 : GGGGCTAGGGTTAGTTCTGGANNNNNNNNNNNNNNNNNNNNN seek() on closed filehandle INFILE at test.pl line 10. Trial 2 readline() on closed filehandle INFILE at /usr/lib/perl5/site_perl/5.8 +.0/Bio/Root/IO.pm line 440.
I know that I can avoid this warnings by replacing SEEK function with "open INFILE.."
But I am curious how can I solve this problem if I intend to keep the SEEK function.
Since I found the solution is neater that way. Hope to hear from you again.
Regards,
Edward

In reply to Re^2: How to avoid using array in concatenating string of multiple lines by monkfan
in thread How to avoid using array in concatenating string of multiple lines OR How To Read FASTA by monkfan

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.