perl hashes question

hi guys im running into a problem here this is my script

#!/usr/bin/perl

use CGI qw(:standard);
$header = "MIME-Version: 1.0\n";
$header .= "Content-type: text/html\n";
$header .= "\n";

#get the point parameter from nhl.html
$Team = param("points");
print "$header";

open(INFILE, "nhl_data") || die "cannot open file";
%rooms= ("points" => 0);
 while(<INFILE>)
{
  if($_=~/$Team/)
  {
    @fields=split(/:/,$_);
    ++$rooms{"$fields[2]"};
    $rooms{"$fields[2]"} = $rooms{"$fields[2]"} +1;
    print "$rooms{$_}";


  }
}

what im trying to do here is: the script is getting the team name from an html file
then this name is searched on the nhl_data once it finds the team is going to count the goals on that specific team using a sum , my question is: how would i go to that specific field in this case field 3 and add each value accordingly?

nhl_data example

Sakic, Joe:Colorado Avalanche:617:994:1343
Recchi, Mark:Atlanta Thrashers:518:847:1386
Sundin, Mats:Toronto Maple Leafs:546:755:1288
Modano, Michael:Dallas Stars:523:744:1298
Roenick, Jeremy:San Jose Sharks:504:686:1300
Selanne, Teemu:Anaheim Ducks:540:597:1045
Fedorov, Sergei:Columbus Blue Jackets:469:663:1174
Brind'Amour, Rod:Carolina Hurricanes:427:685:1322
Tkachuk, Keith:St. Louis Blues:490:475:1029
Weight, Doug:Anaheim Ducks:264:700:1118
Chelios, Chris:Detroit Red Wings:183:761:1600
Lidstrom, Nicklas:Detroit Red Wings:209:714:1234
Kariya, Paul:St. Louis Blues:380:534:875
Roberts, Gary:Pittsburgh Penguins:434:469:1193
Linden, Trevor:Vancouver Canucks:372:489:1365
Kovalev, Alex:Montreal Canadiens:358:488:1047
Alfredsson, Daniel:Ottawa Senators:325:506:832
Naslund, Markus:Vancouver Canucks:366:446:1010
Nolan, Owen:Calgary Flames:379:417:1042

any suggestion would be highly appeciated
thanks guys

Your attempt is fairly close. The first thing you should do and do it now and keep doing it, is use "strict" and "warnings" with all your perl programs. There is no need to build an HTTP header manually, the CGI module will handle that for you.

use strict;
use warnings;
use CGI qw(:standard);
print header();# the CGI module will print the HTTP header using the header function.

my %rooms;

#get the point parameter from nhl.html
my $Team = param("points");

open(INFILE, "nhl_data") or die "cannot open file: $!";
while(<INFILE>){
   my ($team,$points) = (split(/:/))[1,2];#gets the team name and the points only
   if ($Team eq $team) {
      $rooms{$Team} += $points; #add the points using  +=
   }
}
close INFILE;
print $rooms{$Team};

This requires that the input from the html form matches exactly the team name in the file, including spaces and CaSe. Hopefully you have already taken care of that in the html form by creating a menu of some sort that the person using the form will use to pick the team and not just a text box where they write in the name of the team. You could use a regexp to match a team name but than you might get false matches if you are not careful, and judging by the code you posted you are not very familiar with perl.

Is this school work?