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 opt
#!/usr/bin/perl
use strict;
use Win32::Registry;
my $bitReturn = &bitter();
print "OS Bit: $bitReturn \n";
# Testing for the existence of HKEY_LOCAL_MACHINE\Software\Wow6432Node is the most reliable method
sub bitter {
my $Register = "Software\\Wow6432Node";
my ($hkey,$bitReturn);
if ($HKEY_LOCAL_MACHINE->Open($Register,$hkey)) {
$bitReturn = "64";
}
else {
$bitReturn = "32"
}
return $bitReturn;
}
sub bitter {
my $bit;
my $OSbit = `set`;
if ($OSbit =~ m/Files\(x86\)/i) {
$bit = "64";
}
else {
$bit = "32";
}
return $bit;
}