in reply to Using Window System Path Variable in Perl Script

perl provides the entire collection of environment variables in the %ENV hash.

You can get the scalar containing the windows path by indexing it thus:

my $winpath = $ENV{windir}; # Returns C:\WINDOWS or whatever #If you prefer systemroot , my $sysroot=$ENV{SystemRoot};
Offense, like beauty, is in the eye of the beholder, and a fantasy.
By guaranteeing freedom of expression, the First Amendment also guarntees offense.

Replies are listed 'Best First'.
Re: Re: Using Window System Path Variable in Perl Script
by devgoddess (Acolyte) on Mar 15, 2004 at 00:01 UTC
    Oh wow! That's cool! I didn't even know that existed. I read about the %ENV hash in several different books, but none of the books I have mentioned the windir key. Go figure. :-\

    THANK YOU!!!

    Dev Goddess
    Developer / Analyst / Criminal Mastermind

    "Size doesn't matter. It's all about speed and performance."

      At the command prompt in Windows, you can type the command "set" to see all your environment variables.
        Again, this is something I haven't come across in my reading, but that's very cool! :D Any idea if there's a Perl book out there devoted to Windows?

        Dev Goddess
        Developer / Analyst / Criminal Mastermind

        "Size doesn't matter. It's all about speed and performance."

        A reply falls below the community's threshold of quality. You may see it by logging in.