Why use Text::CSV? It's slower and it's broken. If you have Text::CSV_XS, use it. It's faster and it's not broken. In any event, here's one way (untested):
my $CSV_CLASS = $boolean ? $module1 : $module2; eval "use $CSV_CLASS"; if ($@) { croak "Could not use $CSV_CLASS: $@"; } my $csv = $CSV_CLASS->new;
Cheers,
Ovid
Looking for work. Here's my resume. Will work for food (plus salary).
New address of my CGI Course.
In reply to Re: using a variable to specify which perl module to use
by Ovid
in thread using a variable to specify which perl module to use
by princepawn
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |