Help for this page

Select Code to Download


  1. or download this
    use strict;
    my $persistentVar = $defaultvalue;
    ...
      close FH 
        or warn "Failed to close $persistentStateFile, $!" and exit(1);
    }
    
  2. or download this
    END {
        open FH, "< $0" or warn "Failed to preserve state... couldn't open
    + '$0', $!" and exit(1);
    ...
        print FH $_;
        close $file;
    }