Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: Combining multiple lines based on the given condition

by Eily (Deacon)
on Oct 18, 2013 at 19:20 UTC ( #1058806=note: print w/ replies, xml ) Need Help??


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.


Comment on Re: Combining multiple lines based on the given condition
Download Code
Re^2: Combining multiple lines based on the given condition
by anony (Initiate) on Oct 18, 2013 at 19:42 UTC
    Could you please help me bit more. Because I'm new to perl. Thanks.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1058806]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (7)
As of 2015-01-25 04:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My top resolution in 2015 is:

















    Results (180 votes), past polls