CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Need a Custom or Prewritten Perl Program?: I need a program that...: Re: [gopsi1234] Generate a C file from CSV file using perl: Edit Log



gopsi1234
Novice

Jul 1, 2014, 2:16 AM


Views: 51623
Re: [gopsi1234] Generate a C file from CSV file using perl

Hi Zhris

I need to keep the input csv file information in a hash array and then print it to a c file, so that in future, if someone add a new column in between the parsing of data should not change. In case of hash array, the column header can be used as a hash keys to get the value from the respective column and the input file is now a proper csv file. Below is the input file.


Code
/*Below is the input file */ 
vendorid, memid, size, devid, cmd, addr, conf_width, dummy, mode, rate, devicename

0xAF, 0x5501, 32, est, 1, 3, 0, 0, 0, 20, xxx
0xAF, 0x5502, 64, est, 1, 3, 0, 0, 0, 20, yyy
0xAF, 0x5503, 128, est, 1, 3, 0, 0, 0, 20, zzz


Can you please help me in parsing the data from the input file and store it a hash array and finally printing it in the usual format i.e

Code
{0x5501, FLASH_CONFIGURATION_DEVICE(32, xxx, 3, 0, 0, 0, 20, 0xAF)}



(This post was edited by gopsi1234 on Jul 1, 2014, 2:29 AM)


Edit Log:
Post edited by gopsi1234 (Novice) on Jul 1, 2014, 2:29 AM


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives