in reply to Combining multiple lines based on the given condition
The first 13 lines of Text::CSV already show you how to do half the work (there is one extra line though). Except instead of pushing into an array, you have to push the row inside a hash of arrays with the first column has the key.
push @{ $yourHash{shift @$row} }, @$row # shift returns the first element of an array and deletes it from it
If you don't know how to uses hashes and hashes of arrays, read perldsc
Edit: ahem ... square brackets for a hash ... this wouldn't have worked well.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Combining multiple lines based on the given condition
by anony (Initiate) on Oct 18, 2013 at 19:42 UTC |
In Section
Seekers of Perl Wisdom