Skip navigation.
Home
Your source for Perl tips, howto's, faq and tutorials
( categories: )

The name of the underlying operating system is stored in the variable $^O.

Common $^O values

 operating system  $^O value 
Linuxlinux
WindowsMSWin32
AIXaix
Solarissolaris


Note

The value stored in $^O contains only the name of the operating system, not the release number. To determine the release number, consider using POSIX::uname() from POSIX package.

Example:

#-- don't allow to run on Windows systems
die "Sorry, can't run on Windows\n" if ( $^O eq "MSWin32" );