Your approach suffers from a number of misconceptions. Let's look at some of them.

$Excel is a hash. As I think you have worked out for yourself, it isn't. While it is possible that it may be at the top level, there are lower levels where there are certainly arrays, and I suspect that there are also linked lists, which we will look at later.

$Excel has only one level below that. While I'm pretty sure you know better, your code implies this. When you get an unspecified element from $Excel, you don't know what the return type is in advance. It may be hash, array, linked list or some other type.

$Excel is finite. It isn't. This is where we come to linked lists (apologies to language developers if I'm abusing this term). Many objects within Excel have a .Parent element. While there isn't a .child, I will pretend there is to demonstrate the problem, as a large number of children exists. If you imagine object.child, object.child.parent takes you back to the object. You can add infinitely many .parent.child extensions to this. The most I've used in practice is 2, but Excel is unlimited.

$Excel is consistent. Even assuming a single version and service pack, it isn't. In the simplest case, opening a file will add an element to several arrays, while adding a printer to Windows will give Excel an undefined list of potential new properties that it can address.

Unfortunately, I think your quest is doomed. Sorry and all that beastly rot.

Regards,

John Davies


In reply to Re: Finding out Excel 'variables' by davies
in thread Finding out Excel 'variables' by merrymonk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.