in reply to Perl script to read a tab delimited text file

I think you might be looking for something similar to this:

while ( <DAT> ) { my @line = split( /\t/, $_ ); while ( @line ) { my @four_records = splice( @line, 0, 4 ); # think "4 x shift( +@line )" push @array_of_arrays, [ @four_records ]; # make this an array + containing an array of four elements in each array slot. } }

Cheerio, Sören

Replies are listed 'Best First'.
Re: Re: Perl script to read a tab delimited text file
by Happy-the-monk (Canon) on Apr 01, 2004 at 13:30 UTC

    Browsing through the nearly-new uploads to CPAN I found across Array::Each - iterate over one or more arrays, returning one or more.
    That's more a FYI, I think using it in this context would just overcomplicate it, I feel it has it's use when things get much more intricate.

    Cheers, Sören