You can find out which operating system you are running on by looking at the $^O variable (see perlvar for details).
The easiest way to conditionally "use" modules is to replace the "use" with calls to "require" and "import" - as these are executed at runtime.
if ($some_condition) { require SomeModule; SomeModule->import; } else { require SomeOtherModule; SomeOtherModule->import; }
Alternatively, you could look at if.
"The first rule of Perl club is you do not talk about
Perl club."
-- Chip Salzenberg
In reply to Re: Selective use of Use
by davorg
in thread Selective use of Use
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |