in reply to what's faster: use or require
From Perlfunc (slightly paraphrased): use Module; is exactly equivalent to BEGIN { require Module; import Module LIST; } except that Module must be a bareword. Also use Module (); is exactly equivalent to BEGIN { require Module }.
So just do the checks inside a BEGIN block and you shouldn't notice a difference.
In answer to your second question, I give you:
I don't have a foo.pl in my @INC path and this caused no errors or warnings, so I would say "no".#!/usr/bin/perl use strict; use warnings; if (1 == 2) { require "foo.pl"; } print "bar\n";
|
|---|