When first running the page, the table is populated with all the records that it should be populated with. After hitting "End Phase", the table only contains the first record. I'm passing the @Draw as a hidden form field.
I've got 4 test print statements that print out @Draw (so I can see the source printed and try to troubleshoot). Sorry for the mess, but I hope it helps you! Below is my code. Note that The line in question is 138 (at the 4th test print statement. The site is http://staff.washington.edu/guru/james.cgi -James #!/usr/local/bin/perl #include <stdlib.h> use CGI qw(:standard); use strict; print "Content-type: text/html\n\n"; my @Deck; # The whole deck, ordered my @Draw; my @Draw = param("drawHidden") || ""; my @inPlay; my $Played; my @Played = param("PlayedCheckbox") || ""; my $PlayedHidden = param("PlayedHidden") || ""; my @discardCards = param("discardCardsHidden") || ""; my @discardCardsCheckbox = param("discardCardsCheckbox") || ""; my $iterate; my $random; my $control; my $counter = 0; my $valueName; my $turnCounter = param("turnCounter") || 0; print "Test 1.",@Draw,"<br>"; # if the update button has NOT been pressed. # e.g. when the page is just run for the first time. if (param("update") eq "no" || param("update") eq undef){ open (DECK,"james.txt") || die "could not find file: $!"; @Deck = <DECK>; close DECK; @Draw = @Deck; print "Test 2.",@Draw,"<br>"; &Randomize (\@Draw); sub Randomize { $random = shift; for ($iterate = @$random; --$iterate; ) { $control = int rand ($iterate + 1); if ($iterate == $control) { next; } @$random[$iterate, $control] = @$random[$control, $iterate]; } } # Run this code whenever the "End turn" button is pressed }else{ $turnCounter += 1; # Perform all the actions related to # @inPlay splice (@Played, 0,1); # Perform all the actions related to # @inDiscard # Perform all the actions realted to # @Draw # end of the "update" if/else loop } ################################### # Now we start the output section # ################################### print qq| <html> <head> <title>$0</title> <base href="http://www.decipher.com/lordoftherings/cardlists/"> </head> <body bgcolor="#999999"> <h1>James</h1> |; print "Test 3.",@Draw,"<br>"; print qq| <form name="form" method="post" action="http://staff.washington.edu/guru/james.cgi"> <input type="hidden" name="update" value="yes"> <p><a href="http://staff.washington.edu/guru/james.cgi">Start Over</a></p> <input type="submit" value="End Phase"> <div style="font-size:2em;">Draw Deck</div> <table border="1" align="left" bgcolor="#ffffff"> <tr> <th>#</th> <th>Card Name</th> <th>Play</th> <th>Discard</th> </tr> |; #This prints out the randomized array print "Test 4.(Right above the foreach \@Draw block)",@Draw,"<br>"; # the foreach block is seeingthe first space in the first $item # as the end of the first $item and then goes onto the next $item foreach my $item (@Draw){ my @foo = split(/\|/, $item); my $rowColor; if ($counter == 7){ $rowColor = "#c0c0c0"; }else{ $rowColor = "#ffffff"; } $valueName = $foo[1]; print "<tr bgcolor='$rowColor'>\n"; print "\t<td>$counter</td>\n"; print qq{\t<td><a href="$foo[3]" target="_new">$valueName</a></td>\n}; print "\t<td><input type='checkbox' name='PlayedCheckbox' value='$counter'></td>\n"; print "\t<td><input type='checkbox' name='discardCardsCheckbox' value=''></td>\n"; print "</tr>\n"; $counter++; } print "</table>\n"; print qq{ <table border="1"> <tr> <th>In Play</th> <th>In Discard</th> </tr> <tr> <td>Cards in play are listed here</td> <td>Cards in the discard pile are listed here</td> </tr> </table> }; my @matches = grep /\n/, @Draw; my $count = @matches; print "<br>There were $count matching strings.<br>"; print "<input type='hidden' name='drawHidden' value='@Draw'>"; print "<input type='hidden' name='PlayedHidden' value='@Played'>"; print qq{ </form> </body> </html> } _________________________________________________________________ MSN Photos is the easiest way to share and print your photos: http://photos.msn.com/support/worldwide.aspx -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]