The stupid question is the question not asked | |
PerlMonks |
Re^3: Parsing CSVby davido (Cardinal) |
on Apr 04, 2014 at 17:12 UTC ( [id://1081169]=note: print w/replies, xml ) | Need Help?? |
Text::CSV won't do it directly, but if you're ok with just blindly removing commas, you can do this:
...which produces...
That seems like it's almost there. But if you need to reverse the order of "words" within the fields that have embedded commas, you could do this:
...which puts "lname, fname mi" into "fname mi lname" order, providing the following results:
FWIW, I am happy to deal with questions where a commonly used CPAN solution is falling short of what you need, but the original question made no mention of what solutions had been explored, or how they failed to meet the need. You tend to get warmer and far more useful responses if you provide us with details on what you tried, how it failed to fill the requirement, a small self-contained code example, sample input (as you did), and sample output. Often, in composing an effective question, the research that goes into its composition leads you to the answer without even asking. But in those cases where the answer is still elusive, you'll be able to demonstrate exactly what small part of the bigger picture is holding you up so that our answers hit the mark on the first try, rather than after a round or two of follow-ups (as has been the case here). I like giving good answers. But sometimes I simply can't devote the time because it's obvious that it's going to take several rounds of asking for additional information before we get to the meat of the problem. That's an unfortunate situation for the person asking, because his question doesn't get the quality of answers he needs, when it could have gotten a quick and accurate answer had it only provided more context. Anyway, welcome to the Monastery, and I hope you find it both helpful and encouraging to your efforts to learn Perl. Dave
In Section
Seekers of Perl Wisdom
|
|