Help for this page

Select Code to Download


  1. or download this
    use Fcntl ':flock';
    sub alter_file {
    ...
      ...read from file...
      close(HANDLE2);  # also releases lock
    }
    
  2. or download this
    sub alter_file {
      open(HANDLE1, ">/some/tmp/file");
    ...
      close(HANDLE1);
      rename("/some/tmp/file", "file");
    }