open my $DOM_WORK_FH, '>/usr/spool/lpd/dom/dom.work' or die "Open dom.work failed $!"; get_text($DOM_WORK_FH); # you could also pass in the filename and open the file in the sub...