Next The Perl Hardware Store DC.pm Version 23

Semaphore Files

         $FILE = '/data/hitcounter';
         print "Content-type: text/html\n\n";
         if (something) {
           open F, $FILE or die ...;
           print while <F>;             # Display file contents
         } else {
           open F, "> $FILE" or die ...;
           my $data = qx{some command}; # Calculate new contents
           print F $data;               # Overwrite file
         }
         close F;


Next Copyright © 2003 M. J. Dominus