in reply to Avoid using a module if it's not available

Sorry, it works for me.

If I execute your code exactly as you wrote it I obtain>

Name "main::FILE" used only once: possible typo at ./x.pl line 4.

I avoided this adding a "close FILE;" at the end and it works w/o errors.

If I substitute FOO::bar with the name of an existing module (namely Data::Dumper) and the conditional code with

if ($can_foo) { print Dumper(undef); }

I get:

$VAR1 = undef;

which is correct too.

Perhaps the problem you get is NOT independant from which module you try and load.

Careful with that hash Eugene.