Syntactic Confectionery Delight | |
PerlMonks |
Re: Splitting a line on just commasby deMize (Monk) |
on Jun 14, 2010 at 17:34 UTC ( [id://844673]=note: print w/replies, xml ) | Need Help?? |
Response: I'd go the Text::CSV route, but this might help get you started
Output:
Thoughts: I haven't really thought why the blanks are being created - if you take away the grep, you'll see what I'm talking about. I still advise using Text::CSV because using this grep method will remove wanted blanks. Therefore, the above code has structural integrity problems. Example: a,b,,d,e You probably really want that space holder there if you're going to be inserting this into a database. The grep would remove it because it has a blank string value (""). Demize
In Section
Seekers of Perl Wisdom
|
|