KSHYAMKUMAR has asked for the wisdom of the Perl Monks concerning the following question:

i am observing following behavior while using Text::CSV. newer version of Text:CSV (1.21) seems to be putting double quotes around the text. older version i am referring to is 1.13. Can someone pin point which version of the Text:CSV is responsible for below change??
use Text::CSV; print Text::CSV->VERSION . "\n"; print Text::CSV->version. "\n";# The version of the worker module my @array = ('REGR_EMEA_UK_CONF_CUST1_BAN ??e???ta?'); my $csv = Text::CSV->new (); my $status = $csv->combine (@array); print $csv->string() . "\n"; exit 0;

output:Old Version 1.13 0.67 REGR_EMEA_UK_CONF_CUST1_BAN ??e???ta?

output: New Version 1.21 0.91 "REGR_EMEA_UK_CONF_CUST1_BAN ??e???ta?"

Replies are listed 'Best First'.
Re: Text::CSV Changes
by toolic (Bishop) on Aug 26, 2015 at 17:03 UTC
    If you want to suppress the quotes, you can use quote_char (note: I'm using a more recent version of Text::CSV):
    use warnings; use strict; use Text::CSV; print Text::CSV->VERSION . "\n"; print Text::CSV->version . "\n";# The version of the worker module my @array = ('REGR_EMEA_UK_CONF_CUST1_BAN ??e???ta?'); my $csv = Text::CSV->new({quote_char => ''}); my $status = $csv->combine(@array); print $csv->string() . "\n"; exit 0; __END__ 1.32 1.04 REGR_EMEA_UK_CONF_CUST1_BAN ??e???ta?
Re: Text::CSV Changes
by KSHYAMKUMAR (Acolyte) on Aug 26, 2015 at 17:04 UTC

    i noticed that below attribute sets that behavior. is it something that is introduced between versions 1.13 and 1.21 ? quote_space By default, a space in a field would trigger quotation. As no rule exists this to be forced in CSV, nor any for the opposite, the default is true for safety. You can exclude the space from this trigger by setting this option to 0

      never mind guys. it was introduced in v1.16 </p?