I don't have much time to help right now, but this might be helpful:
Sometimes the easiest way to make a list of unique values is to use hash
keys. As an example, the below code will take an array of strings and
assign each as a hash key. Since adding duplicate keys basically does
nothing in this case, you can use the keys of the resulting hash as a
list of unique items. You can also use map() if that is easier for you,
but to me this makes more sense, even though it's a few more lines of
code.
my @input = qw(text1 text2 text3 text5 text2 text9 text3);
my %unique;
foreach my $item(@input){
$unique{$item} = 1;
}
foreach my $key(sort keys %unique){
print "$key\n";
}
That might help with one part of the problem. For the rest, one way to
go about it would be to use W1, W2, etc, as keys in a hash of arrays.
Example:
$hash{W1} = [text1,text2,text3];
That should be enough to get started.
-----Original Message-----
From: Andrej Kastrin [mailto:[EMAIL PROTECTED]
Sent: Thursday, January 19, 2006 10:55 PM
To: [email protected]
Subject: Re: Transform column into row
Andrej Kastrin wrote:
<snip>
So, what is the intuition to combine | merge | join 2 tables. E.g., if
we have table;
ID001 W1, W2, ...
ID002 W5, W9, ...
ID003 W3, W2, W10, ...
Then the second table looks like:
W1 text1, text2, text3
W2 text2, text5, text1
W3 text3, text4
The result must be:
ID001 text1,text2,text3,text5 #combine elements from W1 and W2 from
first table
ID002 ...
ID003 ...
I go to study "Perl Programming" now and thank's for all suggestions...
Cheers
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>