Using Perl, how can I determine whether my program is running on 32 bit Windows or 64 bit Windows?
Is there any API available?
I can think of a couple of options..
-
Check the PE_HEADER of some windows file (eg:
c:\windows\explorer.exe) – maybe I can use the details in How can I test a windows dll to determine if it is 32bit or 64bit? -
Check for the existence of
c:\program files(x86)– if it exists then it is a 64 bit OS. Else it is a 32 bit windows OS.
Is there any good way of doing this? Any API available in Perl?
Sys::Info looks promising:
Output:
Note that it incorrectly identifies my laptop’s CPU as being 64 bit (see Intel® Core™ Duo Processor T2300—bug report filed).