in reply to Re^2: Program for Windows and Unix
in thread Program for Windows and Unix

Checking for specific values of $^O is fine if you are absolutely sure that your code will only ever run on the few platforms you check, but what if someone (maybe you) in the future tries to run your code on some other Unix variant than AIX? Then it'll just break again.

Devel::CheckOS can solve that for you:

use Devel::CheckOS qw(os_is); if(os_is('MicrosoftWindows')) { eval 'use Win32::NetResource'; } elsif(os_is('Unix')) { # load something Unix-specific } else { # just in case someone tries to use VMS or BeOS or ... die("$^O is not supported\n"); }