use Win32::Printer::Direct; sub printFile { my $filename = shift; my $val = Printfile("HP DeskJet 870Cxi", $filename); return ($val == 1); }