in reply to Excel process created with Win32::OLE doesn't quit when expected

Unless you're doing something that needs the memory after your $book->Close, I would advise replacing your four lines

$book->Close; Win32::OLE->Uninitialize; undef $book; undef $ex;

with $ex->Quit. I've never encountered the "Uninitialize" method and don't know what it does. But quitting Excel will close the book automatically, while your objects will automatically be undefined when the Perl programme exits.

I think that will solve your problem. Two more tips, though. If you add use Win32::OLE::Const 'Microsoft Excel'; to your use statements, you will get xlVisible, xlMinimised and all the rest.

I've never seen the sub {$_[0]->Quit;} construct before. I've seen things very like it, but I've never used them myself as I've never run into situations where they have seemed necessary. It's unlikely to cause a problem if you know why it's there, but unless it solves a problem (and you're dying on the same line, which should cope), you might prefer to take it out.

Regards,

John Davies