in reply to A better way to split CSV files with quoted strings that may contain commas?
The input data was:@inline=(); push(@inline, $+) while $pre_inline =~ m{'([^\'\\]*(?:\\.[^\'\\]*) +*)',? | ([^,]+),?| , }gx; push(@inline, undef) if substr($pre_inline,-1,1) eq ','; $semi_thirty_char_node_key = $inline[0]; $mem_size = $inline[4]; $spec = $inline[5]; $num_proc = $inline[6]; $model = $inline[10]; $os = $inline[11]; $alias = $inline[14]; $perf_rate_type = $inline[15]; $node_mode = $inline[18]; $num_logical_processors = $inline[19];
So, instead of using the split with undefs I resorted to indexing off of $inline, but it worked! granted, timtowtdi, but if you have a more elegant way, please comment. Thanks to all who helped so far! I will try to help others in the future too!;pdbdevd1 Olx8jQCKrnQvrA0,'IBM eServer p5 595 1900MH',pdbdevd1,I +BM_P5_595_1900,4096.000000,394.848511,27,,,,IBM_p5_595_1900,AIX,,,pdb +devd1,SPECINTRATE2000,EST,'IBM,02028C8AD',LOGICAL,2,DLPAR,SMT
|
|---|