Hi!

I'm trying to introduce conditional module loading in a Perl program, but I'm experiencing problems. For example:

...
if ($some_condition) {
   use ModuleA;
   (doing something using ModuleA)
}
else {
   use ModuleB;
   (doing something using ModuleB)
}

That is, if $some_condition is true then load the ModuleA, if false load ModuleB. However, it doesn't seem to work this way and I've observed (counterintuitively :) that both modules are always loaded (ModuleA and ModuleB), no matter the value of $some_condition.

Is it possible to do such "conditional module loading" in Perl? What am I doing wrong? Some workaround?

Thanks in advance!

Best regards,

--------------------
Fermín Galán Márquez
CTTC - Centre Tecnològic de Telecomunicacions de Catalunya
Parc Mediterrani de la Tecnologia, Av. del Canal Olímpic s/n, 08860
Castelldefels, Spain
Room 1.02
Tel : +34 93 645 29 12
Fax : +34 93 645 29 01
Email address: fermin dot galan at cttc dot es

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to