Help for this page

Select Code to Download


  1. or download this
    $_ = <RECORD>;
    
  2. or download this
    open(RECORD, "$DATAFILE") or error_page_exit("Could not open datafile"
    +);
    $_ = <RECORD>;
    $val = $_;
    close(RECORD);
    
  3. or download this
    open RECORD, "+< $DATAFILE"
    
  4. or download this
    flock RECORD, 2; # exclusive lock
    
  5. or download this
    my $val = <RECORD>; chomp $val; $val++;
    
  6. or download this
    seek RECORD, 0, 0;
    
  7. or download this
    print RECORD "$val\n";
    close RECORD; # automatically releases the lock