On Wed, Jan 18, 2006 at 01:34:01PM +0100, John Doe wrote: > Andrej Kastrin am Mittwoch, 18. Januar 2006 10.49: > > Dear Perl users, > > > > what's the best way to transform column table in row format. I know how > > to split each line according to delimiter and than put it separately > > into array, but I have more complicated problem (with multiple equal > > records in the first column) > > > > id001 text1 > > id001 text2 > > id001 text3 > > id002 text23 > > id002 text555 > > id003 text666 > > > > and want something like: > > > > id001 text1 text2 text3 > > id002 text23 text 555 > > id003 text666 > > > > Thank's for any suggestions. > > My suggestion is that you show us what you tried so far, since this list is > not a script service.
But he didn't ask for a script, he asked for suggestions on the best way to do something. [As a side note, and not directed specifically to John Doe, this list seems to be becoming a little less friendly to beginners than it used to be. I think that is a shame. Of course, no one wants to be taken advantage of, but a little slap of the wrist whilst providing some clues and pointers seems to be a reasonable compromise.] In most programming problems, I find that if you can design the correct data structures the code pretty much writes itself. In this case, the correct data structure seems to be a hash of arrays. See perldoc perldsc. With this data structure, and the knowledge you already have, I would expect a solution to present itself. If you still have problems, do as John Doe suggests, and come back to us with the code you have already tried. -- Paul Johnson - [EMAIL PROTECTED] http://www.pjcj.net -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>