in reply to Re^3: Include module at compile time with condition
in thread Include module at compile time with condition

Eliya wrote:
Note that the fat comma doesn't work here under use strict (i.e., you'd still need to quote the module name):
#!/usr/bin/perl use strict; use if ( 1 ) , Time::HiRes => qw(time) ; $ ./903506.pl Bareword "Time::HiRes" not allowed while "strict subs" in use at ./903 +506.pl line 3. Execution of ./903506.pl aborted due to compilation errors.
That’s easily fixed. The fat‐comma isn’t the only way to please use strict, you know. Just use “package-quoting” on the module name: Time::HiRes::. Now that doesn’t even need fat‐comma any longer:
% perl -Mstrict -e'printf "%s is %d chars long.\n",
                        English::, length(English::)'
English is 7 chars long.
See how that works? Perfectly use strict–complaisant, too. Nifty, eh? That means that this compiles and runs just fine:
#!/usr/bin/perl use strict; use if ($^V gt v5.7.3), Time::HiRes::, qw(time);
And so does this:
#!/usr/bin/perl use strict; use if $^V >= v5.7.3 => Time::HiRes:: => time => ();

Although some of that there just might maybe get you a tad talked about.   😻