in reply to problem with long strings and regex

What is the point of doing it in one blow? Memory stress testing?
use strict; my $length=0; while(<>){ chomp; # did you want to get rid of newlines? otherwise use tr/// $length += length; } print $length, "\n";

print+qq(\L@{[ref\&@]}@{['@'x7^'!#2/"!4']});

Replies are listed 'Best First'.
Re^2: problem with long strings and regex
by flummoxer (Initiate) on Apr 02, 2009 at 07:32 UTC
    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;
    Maybe there's a faster way?