Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re(2): Learning to *really* love references

by FoxtrotUniform (Prior)
on Jul 30, 2002 at 15:44 UTC ( [id://186240]=note: print w/replies, xml ) Need Help??


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

    my $arrayElement = $$arrayRef[0]; my $hashValue = $$hashRef{someKey};

I prefer:

my $array_element = $array_ref->[0]; my $hash_value = $hash_ref->{some_key};

Using arrow notation makes it easier for me to recognize that the thingys in question are references (I find that the extra leading sigil gets lost in the code soup to my eyes). It also makes doing nested dereferences easier:

my $foo = $AoH_ref->[0]->{some_key};

although you'd be better off doing:

my $hash_ref = $AoH_ref->[0]; my $foo = $hash_ref->{some_key};

in most cases.

--
The hell with paco, vote for Erudil!
:wq

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (3)
As of 2024-04-25 20:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found