Hi

I'm trying to inspect the symbols of a package and filter which arrays, hashes, scalars and subs where used.

This works pretty fine for all slots of a glob but for scalars!

Normally unused slots are undef or hold a reference to the corresponding type. (see ARRAYs)

But unused scalar slots automatically hold \undef which is not distinguishable from using them and setting them to undef.

DB<191> *PCKG::unknown{ARRAY} => undef DB<192> @PCKG::foo=(1,2,3) => (1, 2, 3) DB<193> *PCKG::foo{ARRAY} => [1, 2, 3] DB<194> *PCKG::foo{SCALAR} # why \undef and not undef ??? => \undef DB<195> $PCKG::foo=undef => undef DB<196> *PCKG::foo{SCALAR} # same effect => \undef DB<198> undef $PCKG::foo => undef DB<199> *PCKG::foo{SCALAR} # again => \undef

Any idea how to solve this?

Cheers Rolf


In reply to Problem to inspect scalars in STASH by LanX

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.