Problems? Is your data what you think it is? | |
PerlMonks |
Re: CSV file to C file conversion using perlby sundialsvc4 (Abbot) |
on Jun 19, 2014 at 13:26 UTC ( [id://1090462]=note: print w/replies, xml ) | Need Help?? |
Okay, “not a code-writing service,” but here’s a bit of a leg-up since you’re new. In general, your script will consist of something vaguely like this: (extemporaneous coding ... might not compile ...)
The loop assembles, in $record, a hashref consisting of all of the values listed in the file, with an additional chip_id tag containing the value from the CHIP record. The program “simply assumes” that the input-file is well-formed, with both CHIP and END records for each chip, and that all of the expected tags will be present for each chip ... a reasonable assumption in this case. This logic is probably extremely similar to the logic that was used to create the file. Now, carve out some time to spend with the perldocs that are tutorials, as well as things like perldoc -f split. And, also spend considerable time using Super Search here. Perl is actually well-documented, and there is a lot to it. Welcome to the Monastery!
In Section
Seekers of Perl Wisdom
|
|