use File::Spec; sub phork { #... open(STDOUT, '> ' . File::Spec->devnull); open(STDERR, '> ' . File::Spec->devnull); #... }