Cool, here's a few suggestions

Here's a quick clean up of your code with the above suggestions:

#!/usr/bin/perl use CGI ':standard'; use CGI::Carp "fatalsToBrowser"; use strict; use warnings; my $i = 1 + (param('i') || 0); my $firstroll1 = param('roll1'); my $firstroll2 = param('roll2'); print header; my $dice1 = 1 + int rand 6; my $dice2 = 1 + int rand 6; print "($i) $dice1, $dice2<br>"; if (!$firstroll1 || !$firstroll2) { $firstroll1 = $dice1; $firstroll2 = $dice2; my $sum = $dice1 + $dice2; if ( $sum == 7 || $sum == 11 ) { print "you win"; print qq{<hr><a href="dice.cgi">play again?</a>}; exit; } elsif ( $sum == 2 || $sum == 12 ) { print "you lose"; print qq{<hr><a href="dice.cgi">play again?</a>}; exit; } } else { if ($dice1 == $firstroll1 && $dice2 == $firstroll2 ) { print "match"; print qq{<hr><a href="dice.cgi">play again?</a>}; exit; } elsif ($dice1 == $firstroll2 && $dice2 == $firstroll1 ) { print "match"; print qq{<hr><a href="dice.cgi">play again?</a>}; exit; } } print qq{<a href="dice.cgi?i=$i&roll1=$firstroll1&roll2=$firstroll2">R +oll Again?</a>};

In reply to Re^5: read write from a file by wind
in thread read write from a file by friar tux

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.