in reply to Re^2: Problem with ``use if COND, Some::Module'' on Linux
in thread Problem with ``use if COND, Some::Module'' on Linux

The following works...

my $is_win = $^O =~ /MSWin/ ? 1 : 0; use if $is_win, 'Win32::Daemon'; use if ! $is_win, 'Proc::Daemon';

Replies are listed 'Best First'.
Re^4: Problem with ``use if COND, Some::Module'' on Linux
by Laurent_R (Canon) on Apr 08, 2016 at 17:51 UTC
    Do you really need a ternary operator here?

    I would think that:

    my $is_win = $^O =~ /MSWin/;
    works the same way, doesn't it?
      neither version works, my $is_win is undef when "use if" is testing it at compile time