Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?

Re: Re: Learning to *really* love references

by tmiklas (Hermit)
on Jul 30, 2002 at 22:32 UTC ( #186383=note: print w/replies, xml ) Need Help??

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


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};
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.

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (4)
As of 2022-05-22 14:30 GMT
Find Nodes?
    Voting Booth?
    Do you prefer to work remotely?

    Results (80 votes). Check out past polls.