open(F, "file") or &wite2logfile; # tu dies und das close(F); sub write2logfile { open(F, ">> file.log"); print F $!; close(F); }