#!/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
In reply to Re: combine duplicate entries
by Mandrake
in thread combine duplicate entries
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |