"the message, "Main::$doc only used once" which may be something."

Yes, it indeed is "something."

It is telling you that you have used the variable $doc only once (in scope) in your script.

Perhaps you've drawn an incorrect conclusion about visibility (which I infer from your title): $doc is visible to perl in (some part of) the script; if you want "eyeballs on" the contents of $doc, you'll need to send it to your console (screen), and, if you want an accurate display, decode from Word's character set to the once used by your console. (see davies's Re: Win32::OLE not opening a window for me above)....

( ... and, of course, that presumes that you've provided an accurate path and filename in $document_path. More detail on the script may be needed to ascertain that, if there's another problem.)

Update: ... 'oops!', says /me. I now think I misunderstood/misread part of your problem. The message you quote is, indeed, telling you what I said in the first two para after the quote, but John Davies' understanding of what you were talking about re "visible" seems likely to be far closer to be an answer to your visibility issue than that in the portion marked by strikethrus above.

Update 2: PS: if you're using strict (highly recommended because it can help find one's errors), then you should have received another message... something to the general effect that " ... $doc requires requires explicit package name at line nnn." The more we know about things like error messages and warnings, the better the help we provide (as long as we don't misread the problem :-( ).


In reply to Re: Win32::OLE not opening a window for me by ww
in thread Win32::OLE not opening a window for me by Anonymous Monk

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.