How do I put each character in a text file on individual lines using a perl script?

Question by Steven: How do I put each character in a text file on individual lines using a perl script?
I have a text file with a large number of letters (representing a DNA sequence) with 100 letters on each line. How can I manipulate the file so that each line in the perl script contains one character?

Best answer:

Answer by Tizio 008
if you mean you want loop over each letter of every line, something like

while($ line = )
{
@letters = split //, $ line;
foreach $ l ( @letters )
{
print $ l;
}
}

or something similar.

What do you think? Answer below!

Comments are closed.