... use File::Spec (); ... open $null_fh, '>', File::Spec::->devnull(); ...