in reply to Open multiple file handles?
Use a hash to hold the data you are building. From the example, you read (key,value) pairs from the input. Then you output, for each key, all the values it had been used with. after reading $key and $value, do a push @{$concordance{$key}},$value;. Then when you are all done, something like
while (my ($key, $vals)=each %concordance) { say $key, ' ', join(' ', @$vals); }
|
|---|