http://www.perlmonks.org?node_id=1034183


in reply to Scalar followed by parenthetical...

Not a bug. As $_{A} (did you mean $_->{A} perchance?), is undef, all hash keys 'B' that have a non-true value are (re)set to undef:

C:\test>junk Use of uninitialized value $_{"A"} in concatenation (.) or string at C +:\test\junk.pl line 13. $_{A} ::=> $VAR1 = [ { 'A' => 1, 'B' => undef }, { 'A' => 2, 'B' => 2 }, { 'A' => 2, 'B' => undef } ];

Might have expected a warning though?


With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.

Replies are listed 'Best First'.
Re^2: Scalar followed by parenthetical...
by LanX (Saint) on May 19, 2013 at 02:56 UTC
    > Not a bug.

    > Might have expected a warning though?

    Since the OP's code uses strict it should die with

    Global symbol "%_" requires explicit package name at ... Execution of ... aborted due to compilation errors.

    Cheers Rolf

    ( addicted to the Perl Programming Language)

      But isn't %_ immune to strict in the same way and for the same reasons as $_ and @_?

      C:\test>perl -cmstrict -E"say %_" -e syntax OK

      That is, they are all 3 a part of the same typeglob.


      With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
      Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
      "Science is about questioning the status quo. Questioning authority".
      In the absence of evidence, opinion is indistinguishable from prejudice.