Home: Perl Programming Help: Beginner:
Hash to CSV



logged
New User

Jun 22, 2017, 7:33 AM


Views: 2819
Hash to CSV

I would like to get a CSV file from this hash:

Code
'TREE' => { 
'ID' => '12',
'TYPE' => 'tree',
},
'CAR' => {
'ID' => '15',
'TYPE' => 'car',
},


The CSV files should look like this:
12_tree.csv
15_car.csv

Could somebody tell me how to do that? :)

Thank you for helping me Wink


FishMonger
Veteran / Moderator

Jun 22, 2017, 7:41 AM


Views: 2817
Re: [logged] Hash to CSV


Quote
The CSV files should look like this:
12_tree.csv
15_car.csv


Is that supposed to be the contents of the csv file, or the filenames?


logged
New User

Jun 22, 2017, 7:44 AM


Views: 2814
Re: [FishMonger] Hash to CSV

It should just be the file name:)


FishMonger
Veteran / Moderator

Jun 22, 2017, 7:49 AM


Views: 2810
Re: [logged] Hash to CSV

This looks like your class homework assignment.

What have you tried?

What errors/warnings are you receiving?

What should the contents look like?

How does your output differ from what you expect?


logged
New User

Jun 22, 2017, 8:06 AM


Views: 2808
Re: [FishMonger] Hash to CSV

Not really im just new in perl.
I created a foreach and it worked fine.

I just wrote car and tree cause of data protection....

but thanks for you help...