in reply to Making an array out of each line of a text file
while (<DATA>) { chomp; my @line = split /,\s*/; my $key = shift @line; push @{$data{$key}}, \@line; } print $data{"Andrea"}[0][1], " should be good\n"; # offsets off by one print $data{"Dave"}[0][1], " should be better\n"; print $data{"Joe"}[0][1], " should be 0\n"; __END__ Andrea, 6, good, nice, 3 Bill, 5, 4, better, 5, 7, 4 Clark, 4, 5 Dave, best, better, best Joe, 5, 0 Joe, 4, 6 William, 6, 7, 8, 3 , 1 ,5 Andrea, 45, bettr, best, 6
-- Randal L. Schwartz, Perl hacker
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
RE: Re: Making an array out of each line of a text file
by Anonymous Monk on Aug 25, 2000 at 21:37 UTC | |
by merlyn (Sage) on Aug 25, 2000 at 21:39 UTC | |
by Anonymous Monk on Aug 25, 2000 at 21:54 UTC | |
by tye (Sage) on Aug 25, 2000 at 21:55 UTC |