in reply to conditional USE MODULE

In order to use a conditional use, you'll need to place your code in a BEGIN block with a couple of evals. It's relatively easy:
#!/usr/bin/perl -l use strict; use warnings; BEGIN { my $OS_win = ($^O eq "MSWin32") ? 1 : 0; print "Perl version: $]"; print "OS version: $^O"; if ($OS_win) { print "Loading Windows modules"; eval "use Win32::SerialPort"; die "$@" if $@; } else { print "Loading Unix modules"; eval "use Device::SerialPort"; die "$@" if $@; } }