N
nun
I wrote a script which parses csv data files which were provided to me
in the following format.
WL,WA6B,SCRAPE,N,5.99,6.85,8.56,4.98
WL,W30,RULE6"",N,7.90,47.90,6.05,3.15
Note the comma field separator and that some fields have double quotes
in the data.
My script read this data in as follows and all was well:
###############################
# reading data in from file
my (@AoA);
while ( <> ) {
chomp;
push @AoA, [ split /,/ ];
}
################################
Now suddenly I'm being given the data in a slightly different format,
still comma separated but now all fields are enclosed by double quotes,
even those which have double quotes in the data, such as:
"WL","WA6B","SCRAPE","N","5.99","6.85","8.56","4.98"
"WL","W30","RULE6""","N","7.90","47.90","6.05","3.15"
Is there an easy way I can modify my code to deal with this new format,
or must I start over with something like TEXT::CSV instead of split? I'm
no perl guru and am hoping for an easy cure
DB
in the following format.
WL,WA6B,SCRAPE,N,5.99,6.85,8.56,4.98
WL,W30,RULE6"",N,7.90,47.90,6.05,3.15
Note the comma field separator and that some fields have double quotes
in the data.
My script read this data in as follows and all was well:
###############################
# reading data in from file
my (@AoA);
while ( <> ) {
chomp;
push @AoA, [ split /,/ ];
}
################################
Now suddenly I'm being given the data in a slightly different format,
still comma separated but now all fields are enclosed by double quotes,
even those which have double quotes in the data, such as:
"WL","WA6B","SCRAPE","N","5.99","6.85","8.56","4.98"
"WL","W30","RULE6""","N","7.90","47.90","6.05","3.15"
Is there an easy way I can modify my code to deal with this new format,
or must I start over with something like TEXT::CSV instead of split? I'm
no perl guru and am hoping for an easy cure
DB