You can't always replace 'use' with 'require' because they work slightly differently. 'use' works at compile time and also imports stuff into your code. 'require' works at run time and never imports stuff.
This example isn't exactly like your problem, but I think it might be useful anyways.
BEGIN { if ($^O eq 'MSWin32') { eval "use APDM::ConfigWin32"; print $@ if ($@); } else { eval "use APDM::ConfigUnix"; print $@ if ($@); } }
In reply to Re: using 'use' conditionally
by blssu
in thread using 'use' conditionally
by xafwodahs
For: | Use: | ||
& | & | ||
< | < | ||
> | > | ||
[ | [ | ||
] | ] |