$^O values for various operating systems

Compiled from info in perlport - Writing portable Perl (version 1.39, last modified 11 February 1999, maintained by Chris Nandor pudge@pobox.com).

As of version 5.002, Perl is built with a $^O variable that indicates the operating system it was built on. This was implemented to help speed up code that would otherwise have to use Config; and use the value of $Config{'osname'}. Of course, to get detailed information about the system, looking into %Config is certainly recommended.

-- perlport

Last update: 20.05.1999. Send corrections/additions to perl@alma.ch

Family Common name $^O $Config{'archname'} notes
Unix AIX aix aix
BSD/OS bsdos i386-bsdos
dgux dgux AViiON-dgux
DYNIX/ptx dynixptx i386-dynixptx
FreeBSD freebsd freebsd-i386
Linux linux i386-linux
i586-linux
ppc-linux
HP-UX hpux PA-RISC1.1
IRIX irix irix
openbsd openbsd i386-openbsd
OSF1 dec_osf alpha-dec_osf
reliantunix-n svr4 RM400-svr4
SCO_SV sco_sv i386-sco_sv
SINIX-N svr4 RM400-svr4
sn4609 unicos CRAY_C90-unicos
sn9617 CRAY_J90-unicos
sn9716
sn6521 unicosmk t3e-unicosmk
SunOS solaris sun4-solaris
i86pc-solaris
SunOS4 sunos   sun4-sunos
Unix?   netbsd  
  sco3  
  ultrix  
DOS MS-DOS dos
PC-DOS
OS/2 os2
Windows 95 MSWin32 MSWin32-x86 Win32::IsWin95 == 1
Windows 98 Win32::IsWin95 == 1
&& hex $build == 1998;

$build = (unpack "A4"x2, sprintf "%08X", (&Win32::GetOSVersion)[3])[1];

Windows NT Win32::IsWinNT == 1
MSWin32-alpha
MSWin32-ppc
  NetWare  
Mac Mac OS MacOS MacOS_PPC
MacOS_CFM68K
Mac OS X Server rhapsody    
  OpenVMS VMS   To determine the architecture that you are running on without resorting to loading all of %Config you can examine the content of the @INC array.
Alpha: grep(/VMS_AXP/, @INC)
Vax:   grep(/VMS_VAX/, @INC)

See perlport for details.

  VOS VOS   To determine the architecture that you are running on without resorting to loading all of %Config you can examine the content of the @INC array.
Stratus: grep(/VOS/, @INC)
Stratus XA: grep(/860/, @INC)
Stratus HP 7100
  or 8000: grep(/7100/, @INC)
Stratus HP 8000: grep(/8000/, @INC)

See perlport for details.

EBCDIC OS/390 os390
VM/ESA vmesa
  Acorn RISC OS riscos
         
  Amiga amigaos    
  BeOS beos    
         
  Plan 9      
  QNX      
  Mach Ten machten    
  MPE/iX mpeix PA-RISC1.1  
         
         

Last update: 20.05.1999. Send corrections/additions to perl@alma.ch