use strict; use warnings; use diagnostics; use Win32::Process; use Win32; my $file= "capture.txt"; my $command = Win32::Process::Create(my $ProcessObj,                       "E:\\Win32app\\JAVA_VERSION\\JRE_142_03\\bin\\java.exe",                       "java.exe -version",                       3,                       NORMAL_PRIORITY_CLASS,                       ".")|| die ErrorReport();                                             $ProcessObj->Suspend();                       $ProcessObj->Resume();                       $ProcessObj->Wait(INFINITE); open ( FILE, ">$file") or die "Can't open $file, stopped"; open ( PIPE, "$command |") or die "Can't open pipe, stopped"; while ()     {      print;      print FILE;     } close(FILE); close(PIPE); sub ErrorReport   {    print Win32::FormatMessage( Win32::GetLastError() );   }