|Think about Loose Coupling|
How to know the Windows OS that perl is running onby alain_desilets (Beadle)
|on Apr 28, 2011 at 17:19 UTC||Need Help??|
alain_desilets has asked for the
wisdom of the Perl Monks concerning the following question:
I have a perl app that can be run on any flavour of Windows, including Windows 7 64 bits.
This app needs to occasionally make external calls to an EXE file. Unfortunately, that EXE needs to be compiled differently for 32 vs 64 bits versions of Windows.
So, my script needs to know which version of Windows it's running on, in order to invoke either the 32 bit or the 64 bit version of the script.
I tried using the $^O variable, but it tells me MSWin32, eventhough the script is running on Win64. My guess is that the value of $^O is the name of the OS under which the perl interpreter was COMPILED, but I need the version of the OS that the perl interpreter is RUNNING on. For all sorts of reasons, we don't want to migrate the perl interpreter to 64 bit version yet.
Is there a way to tell what OS the perl interpreter is RUNNING on?