"be consistent" | |
PerlMonks |
Re: Variable scope issue- effect of "my" on hash ref keys, valuesby tobyink (Canon) |
on Feb 26, 2020 at 13:16 UTC ( [id://11113436]=note: print w/replies, xml ) | Need Help?? |
Why would the "extra fun" bit be in the output? You declared two separate $x variables and they're each references to different hashes. If you put data into one hash, it shouldn't appear in the other one. The only arguable improvement which could be made to Perl with regard to this, is that my $x->{a}->[0] is kinda weird and might be worth warning about. Really that's just a precedence thing though. my is higher precedence than the deref operator, so it just means (my $x)->{a}->[0].
In Section
Seekers of Perl Wisdom
|
|