One more thing, if I want to sort the hash alphabetically by key where do I put the sort function?
I tried it before the while loop that does the printing and on the each function (sort(each(%linehash))) and that just gave me numbers first, colon, player names. and I figure that it wouldn't work. thanks in advance. -stu --- James Edward Gray II <[EMAIL PROTECTED]> wrote: > On Monday, June 2, 2003, at 05:12 PM, Stuart White > wrote: > > > Hmm, this might actually be more productive I > showed > > less abstract example lines. > > Not sure I understand perfectly yet, but I'll give > it another go. > > I don't seen any reason to use the array at all, so > I've removed it. > If you had one that I just didn't know about, send > it on back. > > > #!/usr/bin/perl > > > > use warnings; > > use strict; > > > > open(STATS, "stats.txt") or die "statfile\n"; > > my %linehash; # removed extraneous vars > > while (<STATS>) > > { > > if (/(\w+\b) (Jump Shot)/) # matches default to > $_, so you don't have > > to write it > > { > > $linehash{$1}++; > > } > > } > > while (my($key,$value) = each(%linehash)) # print > when we're all done > > { > > print "$key:$value\n"; > > } > > Hope that helps. > > James > > > -- > To unsubscribe, e-mail: > [EMAIL PROTECTED] > For additional commands, e-mail: > [EMAIL PROTECTED] > __________________________________ Do you Yahoo!? Yahoo! Calendar - Free online calendar with sync to Outlook(TM). http://calendar.yahoo.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]