1. Perl
  2. Predefined variable
  3. here

Get the OS name $^O

To get the OS name , use the predefined variable $^O .

$^O

$^O value and OS type

The value of "$^O" in each OS is summarized.

$^O value Description and link
MacOS MacOS
MSWin32 Windows in general
os2 OS/2
VMS VMS
epoc EPOC OS (probably)
NetWare NetWare
symbian Symbian OS
dos MS-DOS
cygwin cygwin
linux Linux
freebsd FreeBSD
solaris Solaris
Unix (maybe different) Unix
darwin Mac OS X
CentOS Linux

Related Informatrion