http://www.perlmonks.org?node_id=746797


in reply to Program for Windows and Unix

You may use $^O or $OSNAME to determine the operating system.
Check the perlvar tutorial in doubt. Windows is usually MSWin32.