in reply to using a variable to specify which perl module to use

This sounds like a good application of a subclass;
create a MyText.pm:
package MyText; sub init_XS { my $class = shift; my $usexs = shift; if ($usexs) { eval { use Text::CSV_XS; @ISA = ('Text::CSV_XS'); } } else { eval { use Text::CSV; @ISA = ('Text::CSV'); } } } 1;
Then in your program do this:
use MyText; my $usexs = 1; #decide whether to use XS MyText->init_XS($usexs); my $csvobj = MyText->new(); #Text::CSV_XS->new gets called if $usexs is true. #Text::CSV->new gets called if $usexs is false. #do stuff with $csvobj

--

flounder