My Code
===========================================================
open (grades, "game_grades.txt" || die "Can't find database\n";
@data = <grades>;
close(grades);
open (games, "game_games.txt" || die "Can't find database\n";
@games = <games>;
close(games);
foreach $line (@data) {
print "<TABLE BORDER='1' CELLPADDING='2' CELLSPACING='2'>";
print "<TR>";
print "<TD>Add Game for $line";
print "</TD>";
print "</TR>";
foreach $entry (@games) {
($grade, $date, $gtime, $teama, $teamacol, $teamb, $teambcol) = split(/\|/, $entry);
if ($grade eq $line) {
===========================================================
The text file game_grades.txt has 2 entries "A Grade" & "B Grade"
The text file game_games.txt has only one entry as follows
A Grade|January 07 2003|7:00pm|WipeOn|Red|WipeOff|Blue
So the foreach loop will run twice with $line holding the output each time
I then want to $line to $grade (output from game_games.txt) within the if statement
Using "eq" does not return any true matches (i.e. the game_games.txt entry should print when $list equals A Grade) and when I use "==" the game is returned for both variables under $line
Can anyone advise a better way to complete this comparison ?
Thanks
Nige
===========================================================
open (grades, "game_grades.txt" || die "Can't find database\n";
@data = <grades>;
close(grades);
open (games, "game_games.txt" || die "Can't find database\n";
@games = <games>;
close(games);
foreach $line (@data) {
print "<TABLE BORDER='1' CELLPADDING='2' CELLSPACING='2'>";
print "<TR>";
print "<TD>Add Game for $line";
print "</TD>";
print "</TR>";
foreach $entry (@games) {
($grade, $date, $gtime, $teama, $teamacol, $teamb, $teambcol) = split(/\|/, $entry);
if ($grade eq $line) {
===========================================================
The text file game_grades.txt has 2 entries "A Grade" & "B Grade"
The text file game_games.txt has only one entry as follows
A Grade|January 07 2003|7:00pm|WipeOn|Red|WipeOff|Blue
So the foreach loop will run twice with $line holding the output each time
I then want to $line to $grade (output from game_games.txt) within the if statement
Using "eq" does not return any true matches (i.e. the game_games.txt entry should print when $list equals A Grade) and when I use "==" the game is returned for both variables under $line
Can anyone advise a better way to complete this comparison ?
Thanks
Nige