Well, I think I went overboard in wanting to make up for being less than helpful. I wanted to at least confirm your symptoms, with the idea of lending more credence to the apparent fact that Microsoft lies (gasp!) about limits vis-a-vis environment variables.

So I typed in a simple Perl program as you indicated:

#!/usr/bin/perl -w # vim:ft=perl:ts=4:sw=4:et:is:hls:ss=10: use strict; use warnings; my $the_cmd = 'dir'; printf "About to call system('%s') ...\n", $the_cmd; my $rc = system( $the_cmd ); printf "Return code from system() call was %d (0x%04X)\n", $rc, $r +c;
Then (and in part to remind myself why Perl is *so* much better) I typed in a batch file (WinXPSP2) to test with:

(oh faint of heart - shield your eyes!)

@echo off :menu1 echo c)lear all echo f)ill a bunch echo l)ist them echo s)ize them echo r)un Perl program echo q)uit set /p zans="what to do? [cflqrs] " if "%zans%X"=="X" goto menu1 if /i "%zans%"=="c" goto docl1 if /i "%zans%"=="f" goto dofl1 if /i "%zans%"=="l" goto doli1 if /i "%zans%"=="q" goto doqu1 if /i "%zans%"=="r" goto doru1 if /i "%zans%"=="s" goto dosz1 goto menu1 :docl1 set zcount=350 set zcounter=1 :clagain rem echo I see %zcounter% and %zcount% if %zcount% LSS 1 goto :menu1 if not defined zenv%zcounter% goto menu1 rem echo Once again, doing zenv%zcounter% ... set zenv%zcounter%= set /a zcounter+=1 set /a zcount-=1 goto clagain :dofl1 --------------------------------------------------- set /p zans="how many should I fill? " if "%zans%X"=="X" goto menu1 set zcount=%zans% echo Will fill %zcount% environment variables with 100-char values :flagain if %zcount% LSS 1 goto :menu1 set zenv%zcount%=a123456789b123456789c123456789d123456789e123456789f12 +3456789g123456789h123456789i123456789j123456789 set /a zcount-=1 goto flagain :doli1 set zenv goto menu1 :dosz1 set zenv >zenv.size set >all.env.size dir zenv.size all.env.size goto menu1 :doru1 perl -w joinersw1a.pl goto menu1 :doqu1 echo okay, quitting, bye! goto :eof rem vim:ft=dosbatch:ts=2:sw=2:et:is:hls:ss=10:
I then ran it, asking for increasing numbers of environment variables to be filled with short 100-char strings. I did hit a limit fairly quickly. Below are snippets from the output:
how many should I fill? 260
Will fill 260 environment variables with 100-char values
10/03/2004  23:33            29,983 all.env.size
10/03/2004  23:33            28,492 zenv.size
About to call system('dir') ...
CGI-Application-MailPage-1.2.tar.gz  hexdmpr.pl~      murugu1.pl
    ::      ::     ::
hexdmpr.pl~                          murugu1.pl
Return code from system() call was 0 (0x0000)

how many should I fill? 265
Will fill 265 environment variables with 100-char values
10/03/2004  23:34            30,533 all.env.size
10/03/2004  23:34            29,042 zenv.size
About to call system('dir') ...
CGI-Application-MailPage-1.2.tar.gz  hexdmpr.pl~      murugu1.pl
    ::      ::     ::
hexdmpr.pl~                          murugu1.pl
Return code from system() call was 0 (0x0000)

how many should I fill? 269
Will fill 269 environment variables with 100-char values
10/03/2004  23:36            30,973 all.env.size
10/03/2004  23:36            29,482 zenv.size
About to call system('dir') ...
CGI-Application-MailPage-1.2.tar.gz  hexdmpr.pl~      murugu1.pl
    ::      ::     ::
hexdmpr.pl~                          murugu1.pl
Return code from system() call was 0 (0x0000)

how many should I fill? 270
Will fill 270 environment variables with 100-char values
10/03/2004  23:35            31,083 all.env.size
10/03/2004  23:35            29,592 zenv.size
About to call system('dir') ...
Can't spawn "cmd.exe": No such file or directory at joinersw1a.pl line 9.
Return code from system() call was 65280 (0xFF00)
All I can really offer is that I can reproduce the problem, and quite close to your problem specification. I can't find any documentation at Microsoft that relates, other than their statements about 65MB max limits. (lies!)

But I do feel you should investigate one or more of the several configuration file solutions. I just have to believe it will be more manageable now and in the future.
(once over that little hiccup of totally changing the way you do things (ouch!))


In reply to Re^3: environment limitations by shenme
in thread environment limitations by joinersw

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.