Hi all, My OS and Perl info: Solaris 8 Perl5 I'm trying to write a perl cgi that will allow me to track the number of form submissions (i.e. 0001, 0002, 0003, etc.). Is flock() the best method? I have included a suggested flock () perl cgi below: ******************************** #!/usr/local/bin/perl use Fcntl qw( :flock ); use Posix; $SIG{ALRM} = sub { die "timeout" }; # initialize SIGALRM handler. eval { alarm(30); # number of seconds before timing out open(ENUMERATE, "+>enumerate") or die "Couldn't open enumeration file"; flock ENUMERATE, LOCK_EX or die "Couldn't lock enumeration file"; chomp($number = <ENUMERATE>); # Small, consolidating change! seek ENUMERATE, 0, SEEK_SET; print ENUMERATE ++$number, "\n"; flock(ENUMERATE, LOCK_UN) or die "Couldn't unlock enumeration file"; close ENUMERATE or die "Couldn't close enumeration file"; } if ($@ =~ /timeout/) { # request timed out. } else { alarm(0); # clear the still-pending alarm unless ($@) { # $number is serialized (consecutive) number. # go nuts! } else { # Problem accessing the file. # $@ is the error message from the corresponding 'die', above. } } ************************* I also want to incorporate the flock () (or other method?) with the following script: ************************ #!/usr/local/bin/perl use CGI qw(standard); #Specify the type of output #print "Content-type:text/html\n\n"; print header; #Store the values in $FORM to specific variables $Month = param('Month'); $Day = param('Day'); $Year = param('Year'); $todayDate = param('todayDate'); $Input_Title = param('Input_Title'); $Input_Inventors = param('Input_Inventors'); $Email = param('Email'); $Agreement = param('Agreement'); $Input_Description = param('Input_Description'); #Mail ComReq open(MAIL, '| /usr/lib/sendmail -t -oi'); print MAIL <<EOF; To: $Email From: patents\@digeo.com Subject: IDEA Form - CONFIRMATION Thank you for submitting a patent IDEA to digeo. We will take special care to process your submission as soon as possible. If you need to contact us in the meantime, send email to patents\@digeo.com or contact Robert Novak at x6004. With much respect, The digeo Patent Group ---------------- This email confirms that you have submitted the following IDEA: ---------------- Date of Invention = $Month/$Day/$Year Submission Date = $todayDate Title = $Input_Title Inventors = $Input_Inventors Primary Contact Email = $Email Description = $Input_Description I agree to digeo submission terms: $Agreement EOF close MAIL; #Mail Travel Request Email Report open(MAIL, '| /usr/lib/sendmail -t -oi'); print MAIL <<EOF; To: patents\@digeo.com From: $Email Subject: IDEA - $Input_Title The following Inventor(s) have submitted an IDEA: $Input_Inventors IDEA Information ---------------------------------------------- Date of Invention = $Month/$Day/$Year Submission Date = $todayDate Title = $Input_Title Inventors = $Input_Inventors Primary Contact Email = $Email Description = $Input_Description Inventor(s) agree to digeo submission terms: $Agreement EOF close MAIL; #Print the results to the user print '<html> <head> <title>Travel Request Confirmation</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head> <body bgcolor="#FFFFFF" text="#000000"> <table border="0" width="614"> <tr> <td width="162" valign="top"><font face="Verdana, Arial, Helvetica, sans-serif" color="#333333" size="4"><img src="https://patents.digeo.com/assets/images/DIGEOLOGO190Master.gif" align="left" border="0" width="190" height="103"></font></td> <td width="487"> <p> </p> <p><font face="Verdana, Arial, Helvetica, sans-serif" color="#333333" size="4"> <b> digeo </b> IDEA Submission Form</font></p> <p><font color="#0033FF" face="Arial, Helvetica, sans-serif"><i><font size="+1">Your IDEA has been submitted....</font></i></font></p> <p><font face="Arial, Helvetica, sans-serif">Thank you for your submission of an IDEA. We will take special care to process your submission as soon as possible. If you need to contact us in the meantime, send email to <a href="mailto:[EMAIL PROTECTED]">[EMAIL PROTECTED]</a> or contact <a href="mailto:[EMAIL PROTECTED]">Robert Novak</a> at x6004.</font></p> <p><font face="Arial, Helvetica, sans-serif">With much respect, </font></p> <p><font face="Arial, Helvetica, sans-serif">The Patents Group<br> <b>digeo</b>, inc. </font></p> <p><font face="Arial, Helvetica, sans-serif"><a href="https://patents.digeo.com"><b><<back to the digeo Patent Website</b></a></font></p> </td> </tr> </table> </body> </html> '; ************************ Thanks! Curtis _________________________________________________________________ Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]