in reply to Re: Get CSV data and convert it to other format data dynamically.
in thread Get CSV data and convert it to other format data dynamically.

Hi VinsWorldcom, The text file has csv data itself. I didnt get why we need to use Text:CSV first and then proceed. We can straight away use Array::Transpose ??
  • Comment on Re^2: Get CSV data and convert it to other format data dynamically.

Replies are listed 'Best First'.
Re^3: Get CSV data and convert it to other format data dynamically.
by VinsWorldcom (Prior) on Aug 24, 2015 at 21:34 UTC

    Text::CSV offers a more robust interface than:

    my @csv; while (<$fh>) { chomp $_; my @p = split /,/, $_; push @csv, \@p; }

    or something like that. If your goal is to be robust, I'd use the module that is solely dedicated to reading that type of data and then another that helps you transform it. Not sure about the JSON output, you're getting a bit out of my league there, but again, if you're looking for robust, readable, supportable code, use the module that's been vetted by all CPAN'ers versus rolling your own.