Well, I got the out put that I wanted. the use
Data::Dumper; call really helped with my debugging,
thanks for the tip. I understand what's going on
except for the printing and the foreach loops, can
someone break that down for me? Also, any other
resources on foreach loops? Thanks in advance, -stu
#!/usr/bin/perl
use warnings;
use strict;
use Data::Dumper;
open(STATS, "stats.txt") or die "statfile\n";
my %fouls;
my $key;
my $value;
my (%shootingFouls, %personalFouls, %clearPathFouls,
%offensiveFouls);
my (%technicalFouls, %illegalDefenseFouls,
%looseBallFouls);
my $type;
while (<STATS>)
{
if ($_ = /(\w+) (Foul:) (\w+)/)
{
$fouls{$3}{$1}++;
print Dumper \%fouls;
#print "$1\t";
#print "$2\t";
#print "$3\n";
}
}
<STDIN>;
print Dumper \%fouls;
<STDIN>;
print "This next output is the good stuff";
<STDIN>;
foreach $type ( qw/Offensive Personal Shooting Loose
Technical Illegal Clear/ )
{
printf "\n%s fouls", $type;
<STDIN>;
my $rank = $fouls{$type};
foreach my $player (keys %$rank)
{
printf "%s: %d\n", $player, $rank->{$player};
}
}
__________________________________
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]