use strict; use warnings; my %bigList; while () { chomp $_; next unless length; my $inp = $_; my $client = $inp; my $num = $inp; $client =~ tr/0-9().-//d; $num =~ tr/ a-zA-Z().-//d; #make big list $bigList{$client}{$num}++; } for my $one (sort keys %bigList) { print "$one ", join ', ', sort {$a <=> $b} keys %{$bigList{$one}}; print "\n"; } __DATA__ Wanda Smith (332)432-9887 Freddie Sonere 442-9089 Bob Wilson 332-454-9932 Bob Cartwright (821)987-0089 Felix Harris 433.344.8711 Bob Wilson (888)821- 2248 Sam Burr 455-0327 Gloria Simpson (821)544-9341 Wanda Smith 444-9721 #### Bob Cartwright 8219870089 Bob Wilson 3324549932 Bob Wilson 8888212248 Felix Harris 4333448711 Freddie Sonere 4429089 Gloria Simpson 8215449341 Sam Burr 4550327 Wanda Smith 4449721, 3324329887