in reply to Re^4: Dereferencing in blessed object
in thread Dereferencing in blessed object

can you immediately tell if $$x{key} means ${$x}{key} or ${$x{key}} ?

Personally I've just memorized this special case and yes, when I see $$x{key} or $$y[2] I just know this means $x->{key} or $y->[2]. I sometimes find it a bit nicer because of the parallels bewteen e.g. my %x = ( key => 42 ); print $x{key}; and my $x = { key => 42 }; print $$x{key}, but I also completely understand that people prefer $x->{key}, and I often use this style myself, for example I prefer $self->{key} over $$self{key}.

Replies are listed 'Best First'.
Re^6: Dereferencing in blessed object
by LanX (Saint) on Feb 26, 2021 at 13:32 UTC
    I agree that the parallels are nicer. And I don't know if I could get used to it when I tried harder. (as I said PBP had it's influence on me)

    In any case I use @$href{a..c} for slicing references

    DB<42> @h{a..z}=1..26 DB<43> $hr=\%h DB<44> p @$hr{a..c} 123 DB<45>

    Cheers Rolf
    (addicted to the Perl Programming Language :)
    Wikisyntax for the Monastery