The problem is that the use Win32::NetResource is being executed at compile-time, while the condition is tested later, at runtime.

See CountZero's reply for a way around it:  the module "if".

(Also, the string "aix" would need to be quoted... —> always use strict; )

Update: another way would be to use require (which is being executed at runtime):

unless ( $^O eq "aix" ) { require Win32::NetResource; Win32::NetResource->import(); # if you want any imports }

In reply to Re^3: Program for Windows and Unix by almut
in thread Program for Windows and Unix by Richi

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":