use Win32::API; my $GetDefaultPrinter = Win32::API->new( "rundll32", "int GetDefaultPrinter()" ); my $PID = $GetDefaultPrinter->Call(); print $PID;