Are you maybe leaving behind stuff in the environment upon every iteration? On most Unixes, the command line arguments share a fixed space with the process' environment.
For example, the following would reproduce the issue (tested on Linux):
#!/usr/bin/perl for (1..10) { $ENV{JUNK} .= "ABC" x 5000; my $begin_load = `cat /proc/loadavg`; warn "cat failed: $!" if $?; print $begin_load; } __END__ 0.56 0.43 0.25 1/219 27522 0.56 0.43 0.25 3/219 27523 0.56 0.43 0.25 2/219 27524 0.56 0.43 0.25 2/219 27525 0.56 0.43 0.25 2/219 27526 0.56 0.43 0.25 2/219 27527 0.56 0.43 0.25 3/219 27528 0.56 0.43 0.25 3/219 27529 cat failed: Argument list too long at ./757540.pl line 7. cat failed: Argument list too long at ./757540.pl line 7.
In reply to Re: invoke shell with `` failed
by almut
in thread invoke shell with `` failed
by jiangliguo
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |