use warnings; use strict; my $max = 69; #-- tweak this to get it to fail foreach my $i ( 1 .. $max ) { my $t = "ENV$i"; my $m = max( $i, 20); $ENV{$t} = "big string" x $m; } my @env = keys %ENV; print "# of ENV: ", scalar keys %ENV, "\n"; #-- calculate the lenght of the env list my $env_str = ''; foreach my $key ( keys %ENV ) { $env_str .= "$key=" . $ENV{$key} . " "; #-- space represents \0 internal in pointer } print "Length ENV str: ", (length( $env_str) + 1), "\n"; print `set`; print "RC: ", $?, "\n"; #------------------------------------------------------------------ sub max { my ( $i, $j ) = @_; if ( $i > $j ) { return $i; } return $j; } #### # of ENV: 127 Length ENV str: 30798 RC: -1