in reply to How to know the Windows OS that perl is running on

Using $^O will help you figure out if you're on Windows or Linux. If you look perlvar for the information on $^O, you'll see a note referring the reader to Win32.

Using Win32::GetOSName will get you the version of Windows (XP, Vista, etc.). Win32::GetOSVersion will give you the version numbers. That information might not help you figure out 32-bit vs. 64-bit.

Here's one way to help determine 32-bit vs. 64-bit. Have your code look at the top level directories of the c: drive. A 64-bit Windows will have "Program Files" and "Program Files (x86)" directories and a 32-bit Window will have only a "Program Files" directory. Might not be very elegant, but should get the job done.

  • Comment on Re: How to know the Windows OS that perl is running on