Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: Scalar followed by parenthetical...

by BrowserUk (Pope)
on May 19, 2013 at 02:48 UTC ( #1034183=note: print w/ replies, xml ) Need Help??


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 (Chancellor) 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.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1034183]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (4)
As of 2016-08-29 01:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    The best thing I ever won in a lottery was:















    Results (397 votes). Check out past polls.