On Fri, 26 Sep 2003, Noushad Dawood wrote: > I'm trying to read a huge CSV file which got 30 columns separated by comma, > but i only need to get values of 3rd, 12th and 20th columns. Is there a > neat and easy way to get this done? >
One way would be to use an array slice: while($row=<CSV>) { chomp($row); @data=(split(/,/,$row))[2,11,19]; . . } Alternatively if you need those specific column values as separate scalars instead of three elements of an array then: ($item1,$item2,$item3)=(split(/,/,$row))[2,11,19]; The chomp($row) isn't strictly needed since you are not using the last column. **** [EMAIL PROTECTED] <Carl Jolley> **** All opinions are my own and not necessarily those of my employer **** _______________________________________________ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs