develooper Front page | perl.beginners | Postings from March 2008

How do I dynamically adjust to CSV format?

Thread Next
From:
Dennis G. Wicks
Date:
March 25, 2008 18:22
Subject:
How do I dynamically adjust to CSV format?
Greetings,

I get data in CSV files from several different sites 
and I can't get the date/time formats to be consistent, 
let alone have the fields arranged in the same order.

I can put in the field/column names by hand in a first 
record but I can't find hoe to go about using them to 
change my split operation to get the info from the 
right place depending on the first record that I will 
add to the file.

eg. one file will have columns name,title,phone, 
snail-mail-addr,email while another file will have 
name,email,phone,title. I can certainly change the perl 
program, but as often as I would have to change it the 
failure rate woould be pretty high!

I am certain there is some sneaky perl trick that will 
accomplish this, but I haven't been able to find it!

Many TIA!
Dennis

Thread Next


Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About