flummoxer has asked for the wisdom of the Perl Monks concerning the following question:
then make a file and boom#!/usr/bin/perl -w use strict; my $string; while ( <> ) { $string .= $_; } $string =~ s/\s+//g; print length($string), "\n";
It works fine on like 700mb strings, so has me baffled as I'm not a regex initiate, err acolyte?perl -e 'for ( 0 .. 100000000 ) { print "1234567890\n" }' > ! /scratch +/100m ./evince_oddness /scratch/100m Substitution loop at ./evince_oddness line 10, <> line 100000001
I do know it's an inefficient way to read the file, I'm using File::Slurp but wanted to simplify the problem.
Oh and it happens with 5.10.0 and 5.8.8 64bit linux and 32bit solaris vendor compiled and me compiled so I don't think I just built a wonky perl.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: problem with long strings and regex
by ig (Vicar) on Apr 02, 2009 at 07:10 UTC | |
by flummoxer (Initiate) on Apr 02, 2009 at 07:44 UTC | |
|
Re: problem with long strings and regex
by codeacrobat (Chaplain) on Apr 02, 2009 at 06:45 UTC | |
by flummoxer (Initiate) on Apr 02, 2009 at 07:32 UTC | |
|
Re: problem with long strings and regex
by Anonymous Monk on Apr 02, 2009 at 06:38 UTC |