[Bioperl-l] Printing strings without return
paulo.david at netvisao.pt
Wed Mar 24 13:29:05 EST 2004
You could use chomp(), or chop():
...rest of your script...
chomp() gets rid of newlines at the end, while chop() gets rid of the
final character, whatever it may be. You could also use a substitution:
s/\s// unless />/;
I think that should work...
Gyoergy Abrusan wrote:
> Dear all
> (Beginners question nr. x...)
> I would like to ask how do I make one string from a Fasta file.
> In other words, from:
> the following:
> I wrote a simple script:
> open FILE, "input.txt";
> open (OUT, ">$RESULTS.txt")or die "$0:ERROR: can't write report file\n";
> while ($seq=<FILE>)
> if ($seq =~ />/)
> print OUT "\n$seq";
> print OUT "$seq";
> close OUT;
> The problem is that the lines in FASTA contain a RETURN at the end, so
> the script doesn't change anything. Is there an option in perl to
> print till the RETURN?
> Thanking you in advance.
> Kind regards,
> Gyorgy Abrusan
More information about the Bioperl-l