hi guys im running into a problem here this is my script
Code:
#!/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
Code:
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
Last edited by Yogesh Sawant; 04-09-2008 at 01:04 AM..
Reason: added code tags
hello everyone,
i am creating 2 hashes from 2 different files, then looking for the value of one in the value of the other to make a new file. for example:
file1: DENV => Denver
file2: H224-0A-12 => DENVER
if Denver is found in DENVER (case insensitive), a new hash now contains H224-0A-12... (0 Replies)
Hi,
Is it possible to delcare hashes in KSH the way we do it in Perl.
Like I want to declare something like:
fruits="Juicy"
fruits="healthy"
fruits="sour"
echo fruits
Ofcourse this piece of code does not work in KSH. Please let me know if there is a way of doing it in KSH.
... (2 Replies)
So I have two files that I want to put together via hashes and am having a terrible time with syntax. For example:
File1
A apple
B banana
C citrusFile2
A red
B yellow
C orangeWhat I want to enter on the command line is:
program.pl File1 File2And have the result... (11 Replies)
Hi,
I am stuck at this problem where part of my code would store all the websites that has been accessed by a user. I pull these values from a log file. I want to create a HASH of HASHES ? (Please correct me if this is not the right approach) where I would store all the hits to website with... (4 Replies)
hi there, I have some database output that looks like this
SELECT nic_name,nic_duplex,nic_speed,nic_ip FROM network_table WHERE hostname = "server1"
result is this (ive delimited with a pipe for ease of reading)
bge0|full|1000|10.32.100.1
bge1|full|1000|11.12.101.7 ... (1 Reply)
Hi there
I have a hash of hashes made up of the following data
bge0|100|half|10.36.100.21
bge1|1000|full|10.36.100.22
bge2|1000|full|10.36.100.23
which when i turn into a hash, would look like this inside the system
bge0 ->
nic_speed -> 100
nic_duplex -> half
... (6 Replies)
Hi, sorry, two hash related questions in one day .. but this has got me a bit stuck.
I have a mysql database table that kind of looks like this, the table is called "view1" and a snippet of that table (SELECT'ing just rows with serial number 0629AN1200) is below
serial nic_name ... (2 Replies)
Hi there, I am trying to dereference my hash of hashes but post dereferencing, it seems to lose its structure I am using Data::dumper to help me anaylise.
This is the code im using to build the HoH, (data comes from a file). I have also performed a Dumper on the data structure before and after... (1 Reply)
Hello experts. I'm having problems with a snippet of code.
I was hoping to get help/advice to correct.
A file that this script parses has changed to the point where
I can no longer use a scalar, it looks as though I need to
create an array for a hash of hashes below.
The first output of... (1 Reply)
Discussion started by: timj123
1 Replies
LEARN ABOUT SUSE
wump
WUMP(6) BSD Games Manual WUMP(6)NAME
wump -- hunt the wumpus in an underground cave
SYNOPSIS
wump [-h] [-a arrows] [-b bats] [-p pits] [-r rooms] [-t tunnels]
DESCRIPTION
The game wump is based on a fantasy game first presented in the pages of People's Computer Company in 1973. In Hunt the Wumpus you are
placed in a cave built of many different rooms, all interconnected by tunnels. Your quest is to find and shoot the evil Wumpus that resides
elsewhere in the cave without running into any pits or using up your limited supply of arrows.
The options are as follows:
-a Specifies the number of magic arrows the adventurer gets. The default is five.
-b Specifies the number of rooms in the cave which contain bats. The default is three.
-h Play the hard version -- more pits, more bats, and a generally more dangerous cave.
-p Specifies the number of rooms in the cave which contain bottomless pits. The default is three.
-r Specifies the number of rooms in the cave. The default cave size is twenty-five rooms.
-t Specifies the number of tunnels connecting each room in the cave to another room. Beware, too many tunnels in a small cave can eas-
ily cause it to collapse! The default cave room has three tunnels to other rooms.
While wandering through the cave you'll notice that, while there are tunnels everywhere, there are some mysterious quirks to the cave topol-
ogy, including some tunnels that go from one room to another, but not necessarily back! Also, most pesky of all are the rooms that are home
to large numbers of bats, which, upon being disturbed, will en masse grab you and move you to another portion of the cave (including those
housing bottomless pits, sure death for unwary explorers).
Fortunately, you're not going into the cave without any weapons or tools, and in fact your biggest aids are your senses; you can often smell
the rather odiferous Wumpus up to two rooms away, and you can always feel the drafts created by the occasional bottomless pit and hear the
rustle of the bats in caves they might be sleeping within.
To kill the wumpus, you'll need to shoot it with one of your magic arrows. Fortunately, you don't have to be in the same room as the crea-
ture, and can instead shoot the arrow from as far as three or four rooms away!
When you shoot an arrow, you do so by typing in a list of rooms that you'd like it to travel to. If at any point in its travels it cannot
find a tunnel to the room you specify from the room it's in, it will instead randomly fly down one of the tunnels, possibly, if you're real
unlucky, even flying back into the room you're in and hitting you!
BSD May 31, 1993 BSD