in reply to problem with array

Aha! Here is another one for Supersplit! D/l the module, and use it like:
use SuperSplit; $array=supersplit_open('/,/',"data.txt"); print superjoin("\t",$array);
Good luck with it,

Jeroen
"We are not alone"(FZ)

Replies are listed 'Best First'.
Re: Re: problem with array
by Anonymous Monk on Mar 15, 2001 at 01:16 UTC
    open(FILE, "data.txt"); #opens data.txt in read-mode while(<FILE>){ #reads line by line from FILE which i +s the filehandle for data.txt chomp; push(@data,split(/,/,$_)); } close FILE; #close the file. print "$_\n" foreach (@data);



    Now that I've read the comma delimited rows, split the values, and printed them out, I'd like to only get the middle value and assign it as $co. Basically, how do I just pull the first, second, or third value based on my preference?

      Hmmmm... either I don't understand your question or you'd better have a good ponder at them docs. Do you mean:
      push @data, [split /,/]->[$col] for (<FILE>);
      ?

      Jeroen
      "We are not alone"(FZ)