in reply to Problem with ``use if COND, Some::Module'' on Linux
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.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Problem with ``use if COND, Some::Module'' on Linux
by stevieb (Canon) on Apr 08, 2016 at 17:50 UTC | |
by RonW (Parson) on Apr 08, 2016 at 18:14 UTC |