Help for this page

Select Code to Download


  1. or download this
    $file = "/path/to/file";
    
    ...
    } else {
        # File is empty or does not exist.
    }
    
  2. or download this
    $SIG{ALRM} = sub { die "Script took too long.\n" };
    alarm(60);    # Create alarm signal in 60 seconds.
    # ... do long-running stuff.
    alarm(0);     # Cancel the alarm
    
  3. or download this
    END {
        unlink($tmpfile);
    }