accessing environment variables
How do I access Windows environment vars? I want to be able to test whether I'm in Windows or Linux, and this seems like a good way to do it. If there is an easier/better way, I'm all ears. Thanks Greg
RE: accessing environment variables
| If there is an easier/better way, I'm all ears. Use the variable $^O which contains the name of the operating system. It's MSWin32 for Windows, for example. if( $^O eq 'MSWin32' ) { # ... } else { # ... } Hope this helps. -- Marcus | -Original Message- | From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] | Sent: Friday, October 19, 2001 2:15 PM | To: [EMAIL PROTECTED] | Subject: accessing environment variables | | | How do I access Windows environment vars? | | I want to be able to test whether I'm in Windows or Linux, | and this seems | like a good way to do it. | | If there is an easier/better way, I'm all ears. | | Thanks | Greg | -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: accessing environment variables
In article [EMAIL PROTECTED], [EMAIL PROTECTED] (Greg Froese) wrote: I want to be able to test whether I'm in Windows or Linux, and this seems like a good way to do it. you want $^O, not an environment variable. take a look inside CGI.pm for some example code. :) -- brian d foy [EMAIL PROTECTED] - Perl services for hire CGI Meta FAQ - http://www.perl.org/CGI_MetaFAQ.html Troubleshooting CGI scripts - http://www.perl.org/troubleshooting_CGI.html -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: accessing environment variables
Thanks Brian and Marcus. $^O is exactly what I needed. _brian_d_foy [EMAIL PROTECTED] 10/19/2001 08:44 AM To: [EMAIL PROTECTED] cc: Subject:Re: accessing environment variables In article [EMAIL PROTECTED], [EMAIL PROTECTED] (Greg Froese) wrote: I want to be able to test whether I'm in Windows or Linux, and this seems like a good way to do it. you want $^O, not an environment variable. take a look inside CGI.pm for some example code. :) -- brian d foy [EMAIL PROTECTED] - Perl services for hire CGI Meta FAQ - http://www.perl.org/CGI_MetaFAQ.html Troubleshooting CGI scripts - http://www.perl.org/troubleshooting_CGI.html -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]