Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW

Comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
In the OPís code, warn appears to be treating \my(%hash) as undef, and not as \undef, as would be expected. I donít see the reason for this, either.

\( ... ) returns a list of references, one reference for each item in the list. my(%hash) initializes %hash to be empty so, %hash in a list context gives the empty list. Constructing a reference to each scalar in an empty list gives one an empty list of references, which is just an empty list. warn treats an empty list the same as a list containing one (or more) undef(s). No mystery there (for me).

As to the original question, it looks to me to just be a bug in Deparse.

Now, I could see Perl deciding to go either way on whether \my(%hash) should be treated like \my %hash or like \(my %hash). My guess is that the current behavior was not a conscious choice but was more an accident of implementation details. So it would be conceivable to fix the Deparse bug by changing Perl to agree on this specific point. But that seems unlikely (surely p5p would argue that there might be code that already depends on the current behavior of \my(%hash), a point that I probably give much less weight to but that I agree with).

I'm not going to dive into the Deparse source code to try to get an idea as to how complicated it might be to fix the deparsing of \my %hash (without breaking the deparsing of some other obscure use of 'my'). But I suggest the original poster report it as a bug in the module.

- tye        

In reply to Re^2: Deparse says \my(%hash) is the same as \my %hash but it isn't (empty) by tye
in thread Deparse says \my(%hash) is the same as \my %hash but it isn't by Anonymous Monk

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, 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, 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.
  • Log In?

    What's my password?
    Create A New User
    [Corion]: We-ird - I hadn't known this, but Ingress and Pokemon Go (both AR games in the real world where you run around) switched from using Google Maps to OpenStreetMaps, which is great. But I wonder why, as Ingress is (was?) owned by Google/Alphabet. But ...
    [Corion]: ... maybe not wholly owned, or the load on Google Maps was too high?!

    How do I use this? | Other CB clients
    Other Users?
    Others exploiting the Monastery: (6)
    As of 2018-03-19 09:06 GMT
    Find Nodes?
      Voting Booth?
      When I think of a mole I think of:

      Results (236 votes). Check out past polls.