Parysatis Sachs wrote:
Hi everyone!
Hello,
I'm new to this mailing list as well as to programming and Perl in general. So there is a chance I might ask relatively stupid questions with very obvious answers... Please bear with me! So, here it goes: I have a very long string with lots of Ns in it, like this: attttgctagccgagctaNNNNNNatggctaNNNNNNNatgcccctgaNNNNNNatg So, I want to get rid of the Ns and get ONE SINGLE newline for each group of Ns So far I've managed to do this: if ($joinedDNA =~ s/N+/\n/g) { $joinedDNA =~ s/\R//g; }
That should be just: $joinedDNA =~ s/N+/\n/g; Or just: $joinedDNA =~ tr/N/\n/s; The statement: $joinedDNA =~ s/\R//g; removes all newlines. John -- Any intelligent fool can make things bigger and more complex... It takes a touch of genius - and a lot of courage to move in the opposite direction. -- Albert Einstein -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/