in reply to combine duplicate entries
#!/usr/bin/perl -w use strict; my %hash; (!/^$/) && (push @{$hash{(split /\s+/,$_)[0]}}, (split /\s+/,$_)[1]) w +hile(<DATA>); for my $key (keys %hash) { (print "$key\t$_\n" ) && ($key="") for (@{$hash{$key}}) ; } __DATA__ John red Mike yellow Peter white Peter brown Jim purple Antony orange Antony green George black
|
|---|