print "$_ : $linehash{$_}\n" foreach (sort keys %linehash);
James
On Monday, June 2, 2003, at 07:03 PM, Stuart White wrote:
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 Ishowedless 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$_, so you don't have
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 towhen we're all doneto write it { $linehash{$1}++; } } while (my($key,$value) = each(%linehash)) # print{ 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]
-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]