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


in reply to Re: Learning to *really* love references
in thread Learning to *really* love references

Well...

Long time ago i used to write my code like this:
my $arrayElement = $$arrayRef[0]; my $hashValue = $$hashRef{someKey};
but when I tried to debug or simply read it a few months after coding, it took me a long time to make my brain think the same, wired way as when I wrote the code ;-)

Since then I use
my $arrayElement = ${$arrayRef}[0]; my $hashValue = %{$hashRef}{key};
or
my $arrayElement = $arrayRef->[0]; my $hashValue = $hashRef->{key};
and it depends of the mood ;-)

Anyway IMHO the $$something notation is the worst to read or understand again after some time... If you code alone it's up to you which one to choose, but if I'm a part of a team I just try to be polite, writing my code more readable and easy to understand to my co-workers...

Greetz, Tom.