close(STDERR) or die qq(This should not go wrong, but this happened: $!\n); my $warnings = qq(pid.$$.err_warn); # file to contain warnings & error messages open(STDERR, ">", $warnings) or die qq(unable to open "$warnings" for writing because of: $!\n);