Reputation: 31248
print "$^O\n";
returns
MSWin32
However, my laptop is 64-bit. Any idea if the Perl system call retrieves wrong data (by its or Windows' bug) or is it as designed?
Upvotes: 2
Views: 1324
Reputation: 385915
$^O
is always MSWin32
on Windows.
If you want to know more about the system on which perl
runs, you can use
use Win32;
print Win32::GetOSDisplayName(), "\n";
print Win32::GetOSName(), "\n";
print Win32::GetOSVersion(), "\n";
If you want to know the architecture for which perl
was built, you can use
use Config qw( $Config );
print "$Config{archname}\n";
If you want to know the size of integers, you can use
use Config qw( $Config );
print $Config{ivsize}*8, " bits\n";
Upvotes: 3
Reputation: 57640
Win32 is just the standard Windows API. This has little connection to 32-bit/64-bit processors or OS variants.
From perldoc -v $^O
:
In Windows platforms, $^O is not very helpful: since it is always "MSWin32", it doesn't tell the difference between 95/98/ME/NT/2000/XP/CE/.NET. Use Win32::GetOSName() or Win32::GetOSVersion() (see Win32 and perlport) to distinguish between the variants.
On my system, it isn't very helpful either; returning just a plain linux
;-)
Upvotes: 5