Run your program in the perl debugger. After it, you can print the values of assigned global variables with the |V debugger command. Note that this will print only those variables, that were used, so run the program first and break it after you think it's set all the global variables it uses, and invoke |V only after that. Also, you'll see lots of magic variables and other such junk in the output, which you should ignore.

Then, if you also want to know where those variables are accessed or changed, see Debugging with tied variables, or just grep for their names in the source code.

(Running with strict and seeing the errors is also a good idea, and is probably simpler, as someone else has recommended.)


In reply to Re: grepping out global vars? by ambrus
in thread grepping out global vars? by tphyahoo

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.