The "hint" in the error message provides a big clue.
The arguments to use if are evaluated in list context. Therefore the match expressions are being evaluated in list context.
From the Perl documentation: "When there are no parentheses in the pattern, the return value is the list (1) for success. With or without parentheses, an empty list is returned upon failure."
So, on a non-MSwindows platform, $^O =~ /MSWin/ is returning an empty list.
Of course, on MSwindows, $^O !~ /MSWin/ is failing, but because it has an implied not, it is equivalent to not ($^O =~ /MSWin/) so is returning a non-empty false value.
In reply to Re: Problem with ``use if COND, Some::Module'' on Linux
by RonW
in thread Problem with ``use if COND, Some::Module'' on Linux
by stevieb
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |