in reply to Perl and WINNT write problem

print "$ENV{USERNAME}";
and
$username=$ENV(USERNAME); ... print "$username"; ...
shows nothing.

Replies are listed 'Best First'.
Re: Re: Perl and WINNT write problem
by BrowserUk (Patriarch) on Mar 09, 2003 at 10:54 UTC

    That's strange, USERNAME in normally set. Try this: Noting that they are {}'s not ()'s.

    print "<H1>$_=$ENV{$_}</H1>\n" for key %ENV;

    A couple of things. You don't need to quote the variable names unless your using interpolation to format the value of the variable together with other stuff.

    You say that $username=$ENV(USERNAME); "shows nothing", which is strange, as that line has a syntax error. Have you checked the logs?

    You said this is running under NT4, but not which webserver? Is this a box you have administrative access to? Are you using it local or remotely?


    Examine what is said, not who speaks.
    1) When a distinguished but elderly scientist states that something is possible, he is almost certainly right. When he states that something is impossible, he is very probably wrong.
    2) The only way of discovering the limits of the possible is to venture a little way past them into the impossible
    3) Any sufficiently advanced technology is indistinguishable from magic.
    Arthur C. Clarke.
      print Win32::LoginName();

      On the IIS that ive used $ENV{USERNAME} isn't set for CGI scripts. The Win32 call works though.


      ---
      demerphq