by kstrauser · 1y ago · 0 comments
$a->[2]{"bar"}
The highest rated SO answer here explains a little, and it’s the kind of situational nitpickiness that let to me dropping Perl like a hot potato when something better matching my mental model came across my radar: https://stackoverflow.com/questions/1817394/whats-the-differ... $a->[2]->{"bar"}
which is equivalent and also works, but suffers from the explosion of punctuation that Perl often gets criticised for. There's an element of Do What I Mean where the first arrow says this is a reference and work the rest out for me.So when you see
$a->[2]{"bar"}
then $a is an array reference where each item is a hashmap. But with $a->[2]->{"bar"}
then $a is an array reference where each item is a reference to a hashmap.