Marcus Claesson [mailto:[EMAIL PROTECTED] asked:
> I have a silly little list-parsing problem that I can't get my head
> around, and I'm sure some of you have come across it before.

Sure. Looks like homework ;-)

HTH,
Thomas

#!/usr/bin/perl -w

use strict;

my %unique;

while( <DATA> ){
  my( $key, $value ) = split;
  
  $unique{$key}->{$value}++
}

foreach my $key ( sort keys %unique ){
  print "$key: " . join( ", ", sort keys %{$unique{$key}} ) . "\n";
}

__DATA__
1       a
2       b
2       c
3       a
4       d
4       d
4       e
4       f
5       g

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to