... mutiple lines like ACGTGACGTACGTACGTACGTA AGTACGATCACCCCCGTAGACG ACGTAGACATCAGATCGATAGT ...
From looking at your example data, my guess is that you are working with data records composed of multiple lines of data. Also from your example, it seems that each record begins with a '>' character.
If these guesses are acurate, it may be useful to set the input record separator variable $/ (see perlvar) to '>', then read each record with a single statement and then remove all newlines from the record with a substitution.
Note, however, that because the first record of the file begins with a '>', the first record read from the file (any stuff before the first '>') is junk and must be ignored.
E.g. (untested):
$/ = '>';
# throw away first (junk) record
defined(<$fh>) or ($! and die "reading: $!");
while (defined(my $record = <$fh>) or ($! and die "reading: $!")) {
$record =~ s{ \n }{}xmsg;
process($record);
}
Update: Since a <$fh> record read reads up to and including the input record separator string specified in $/ (or to the end of the file), there should probably be a chomp in that while loop to remove the extraneous '>' character at the end of each record:
while (defined(my $record = <$fh>) or ($! and die "reading: $!")) {
chomp $record; # remove $/ string
$record =~ s{ \n }{}xmsg;
process($record);
}
|