in reply to CSV file to C file conversion using perl

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 ...)

use strict; use warnings; my $record; while (<INFILE>) { chomp; # remove newlines etc. in case it matters my ($tag, $value) = split(","); # implies "$_" if ($tag eq 'CHIP') { # note use of 'eq' not '==' $record = {}; $record->{'chip_id') = $value; } elsif ($tag eq 'END') { # PRINT '$record' IN NICE "C" FORMAT # THIS PART IS UP TO YOU ... } else { $record->{$tag} = $value; } }

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!