Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re^2: Get CSV data and convert it to other format data dynamically.

by ash1351 (Novice)
on Aug 24, 2015 at 21:22 UTC ( [id://1139745]=note: print w/replies, xml ) Need Help??


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.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1139745]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others musing on the Monastery: (7)
As of 2024-04-23 21:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found