in reply to Regexp and newlines, what am I missing?

I guess what's causing you problems is that on some lines, there's only a carriage return at the end of line (in your example, it's those lines with the sequence data).

So what happens is that all those lines (up to the next proper newline (i.e. the one used on your platform)) are being read in as one line; and when you print that string, the carriage returns reposition the terminal cursor to the beginning of the line, so most of data is overprinted...   The "weird" result you're seeing is what remains.

The following snippet demonstrates the effect (note the "\r" at the end of the substrings):

my $newline = "TTTATGCACTCATGTTTAGACATATTTCCTACACCCATATTTGAAGACCA\r" . "... other lines (overprinted) ...\r" . "TAGATTCTGTAAACTGTGTCCATTTCTGTGCCTATTTACTTGGTATTTGT\r" . "TAACTCTTAGTACACATAAGTTTACGTACC\r"; print "\$newline is: $newline\n"; # (this is your debug print)

In other words, you have to make sure that - after cut-n-pasting from one platform to another - the resulting lines are all conforming to the same newline style (preferably the one being used by your OS :)

Several tools can help here, for example dos2unix, unix2dos, ..., or Perl's tr///, or s/// (e.g. tr/\r/\n/). Some editors can do auto-conversions, too. But you have to fix things before you process the data with your program.   Good luck.