in reply to Re: Re: another 'array to hash' question
in thread another 'array to hash' question
(although you could just define one relative to the codechomp($headerline = <INFILE>); my @header = split(/\t/,$headerline);
Now when reading in the filemy @header = qw(fn ln age);
while( <INFILE>) { chomp; my $c = 0; my @columns = split(/\t/,$_); push @a, { map { $header[$c++] => $_ } @columns }; }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Re: Re: Re: another 'array to hash' question
by etcshadow (Priest) on Dec 10, 2003 at 15:55 UTC |