My datasets are growing larger constantly and I ran into this and wondered if it was a problem in the regex or a limit to string length.
It happened as I wanted to read in a file of newline separated strings that represent a contiguous entity, dna, and I thought the quickest way was
use File::Slurp qw( slurp );
my $str = slurp('file');
$str =~ s/\n//g;