I strongly recommend using strictures (use strict; use warnings;), although that is not what is biting you here. In fact your code performs as I would expect (although normalizing whitespace in names would be a good idea - 2 entries for Bob Wilson):

use strict; use warnings; my %bigList; while (<DATA>) { 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

Prints:

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

DWIM is Perl's answer to Gödel

In reply to Re: Combining client phone lists by GrandFather
in thread Combining client phone lists by volcan

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.