in reply to Maximum string length

Theoretically, the maximum length of a string in Perl only depends on how much memory is available. Practically, such big strings are unhandable. Try running the following script to get an impression:
$i=256; while (1) { print ++$i, "\n"; system ("perl -e \"\$_ = 'x' x ($i*1024*1024)\""); }


holli, /regexed monk/

Replies are listed 'Best First'.
Re^2: Maximum string length
by duckyd (Hermit) on Feb 22, 2006 at 19:28 UTC
    why shell out?
    my $i=1; my $x; while (1) { print $i, "\n"; $x = 'x' x ($i*1024*1024); $i += 10; }
    happily eats up all my memory