This is a Tic Tac Toe program I made recently, I used a HTML document with frames that contains the following CGI page and a HTML document (tic2.htm) that refreshes automatically so both players can see when the other makes his move. Well here's the CGI part.
#!/usr/local/bin/perl use CGI ':standard'; print header; print start_html('Tic Tac Toe'), start_form, "Clear the boxes? ", radio_group( -name=>'clear', -Values=>['yes','no',], -default=>'no'), p, "What are you playing? ", radio_group( -name=>'team', -Values=>['X','O',], -default=>'X'), p, "Across: ", radio_group( -name=>'across', -Values=>[1,2,3,], -default=>1), p, "Down: ", radio_group( -name=>'down', -Values=>[1,2,3,], -default=>1), p, submit, end_form, hr; if (param()) { $across = (param('across')); $down = (param('down')); $team = (param('team')); $move = $down."_".$across; $file="../tic2.htm"; $file2="../tic.htm"; open FILE, "<$file" or die "Sorry $!"; open FILE2, ">$file2" or die "Sorry $!"; for $line (<FILE>) { $line =~ s/<! $move ><img src=bla.bmp>/<! $move ><img src=$team.bmp>/g +; #The above checks each line of tic2.htm for the move selected (ex. 1_2 +) and replaces #that squares image bla.bmp with either O.bmp or X.bmp print FILE2 $line; }; close FILE2; close FILE; #Closes the filehandles so that their uses (read, write) can be revers +ed open FILE, ">$file" or die "Sorry no luck opening file"; open FILE2, "<$file2" or die "Sorry"; for $line (<FILE2>) { print FILE $line; }; close FILE; close FILE2; if ((param('clear')) eq 'yes') { open FILE, "<$file" or die "Sorry $!"; open FILE2, ">$file2" or die "Sorry $!"; for $line (<FILE>) { $line =~ s/X/bla/g; $line =~ s/O/bla/g; print FILE2 $line; }; close FILE; close FILE2; open FILE, ">$file" or die "Sorry $!"; open FILE2, "<$file2" or die "Sorry $!"; for $line (<FILE2>) { print FILE $line; }; }; }; print end_html;
Any feedback you could offer would be appreciated, thanks.

In reply to Seeking feedback on Tic-Tac-Toe by Cobo

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.