... use if $^O eq 'MSWin32', Win32::Exit::Prompt => 'exit_prompt'; ... exit_prompt() if $^O eq 'MSWin32'; exit;