in reply to
Exposing perl code as a COM object
I second holli suggestion. I have used the Windows Script Component-WSC for lots of stuff and it works GREAT and you can even make it a Distributed COM object ( info in MicroSofts WSC docs ). Here is one serious pitfall that will save you some head scratching. The WSC file you create is installed most easily by right clicking the file and then selecting Register. You will also see an option "Generate Type Library". Don't waste your time. The Type Library it creates will throw a exception at runtime if you add it as a reference (in Excel or Word) because the object type defined in the Type Library does not and never could match the object you define in your WSC. MicroSoft acknowledges the problem, but doesn't change the docs or fix the problem...<sigh>. ActiveState's PerlCtrl DOES correctly generate the typelib, so if you need the typelib then purchase the PerlDevKit ( it is a great deal IMO and has lots of great stuff like perlapp and perltray and PerlNET ).
After you read the docs and try the examples, you may wonder how to share a perl hash or array with the MicroSoft world. The key is to use Win32::OLE::Variant and Win32::OLE to create either a VT_ARRAY|VT_VARIANT (use the Put method to store ) or use OLE and CreateObject("Scripting.Dictionary") if you want to use a hash-like object ( and yes, you can save other objects as keys or values) "Scripting.Dictionary" was modeled after Perl hashes I believe.:-)
I have some examples if you need more help. I am too busy right now to post them right now.