Between each 1-to-n set of key/value pairs for a record, there is a single blank line. I'd like to turn this into a CSV file in the following format:<key 1> : <value 1> <key 2> : <value 2> .. <key n> : <value n>
What do you all think is the most logical/efficient way to do this? For now, the file is very predictable. The keys for every record are the same. However, this will likely be a long-term solution and I'd like it to be able to handle changes in the number or names of the keys without breaking. I'm considering reading the original file into hashes and arrays, and using the Text::CSV module to generate the output. Just figured I'd call upon the monastery to point out flaws in that plan before implementing it. Thank you all!"key 1","key 2", .. ,"key n" "value 1","value 2", .. ,"value n" <-- record 1 "value 1","value 2", .. ,"value n" <-- record 2 .. "value 1","value 2", .. ,"value n" <-- record n
The Fallen Monkey
In reply to Record dump-style text --> CSV? by fallenmonkey
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |