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]



Reply via email to