$debugger = new Win32::OLE( 'Excel.Application', \&main::QuitApp ); #### $ex = Win32::OLE->new('Excel.Application', sub {$_[0]->Quit;}) # calls $ex->Quit() when the Perl program ends or $ex goes out of scope