my $CSV_CLASS = $boolean ? $module1 : $module2; eval "use $CSV_CLASS"; if ($@) { croak "Could not use $CSV_CLASS: $@"; } my $csv = $CSV_CLASS->new;