It's likely %ENV is tied (I am guessing) or has mechanism similar to tie associated with it to pass lookups to an underlying system call

That mechanism is called "magic". Tied variables are a specific kind (MG_TYPE) of magical variables.

%ENV appears to be magical only under shells where the lookup and expansion of environmental variables is a case-insensitve operation.

It is my understanding that %ENV is magical on all platforms. The magic translates access to %ENV into C library calls.

To see if %ENV is magical, run

perl -MDevel::Peek -e 'Dump \%ENV, 1'

On Windows, that outputs

SV = RV(0x183a4ec) at 0x2251d8 REFCNT = 1 FLAGS = (TEMP,ROK) RV = 0x225db4 SV = PVHV(0x229584) at 0x225db4 REFCNT = 2 FLAGS = (SMG,RMG,SHAREKEYS) IV = 29 NV = 0 MAGIC = 0x182a964 <---- MG_VIRTUAL = &PL_vtbl_env MG_TYPE = PERL_MAGIC_env(E) ARRAY = 0x18257cc (0:13, 1:11, 2:6, 3:2) hash quality = 102.6% KEYS = 29 FILL = 19 MAX = 31 RITER = -1 EITER = 0x0

I don't have access to a unix machine at the moment.

Perl probably doesn't even care whether the env vars are case-sensitive or not. That's probably handled by the C library or passed on the OS.


In reply to Re^4: Win32 GetEnvironmentVariables? by ikegami
in thread Win32 GetEnvironmentVariables? by Anonymous Monk

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.