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

Re: Dereferencing and comment from Camel

by djantzen (Priest)
on Dec 21, 2002 at 04:51 UTC ( #221566=note: print w/ replies, xml ) Need Help??


in reply to Dereferencing and comment from Camel

It just means that given $array_ref = [qw/bar baz/]

$$array_ref[0] is the same as $array_ref->[0]

Similarly, given $hash_ref = { bar => 'baz' }

$$hash_ref{bar} is the same as $hash_ref->{bar}

I've traditionally preferred the double-sigil style, mostly because I strongly disliked the arrow syntax when I first started coding Perl. I think though it is generally regarded as bad because it isn't quite so explicit, and I admit my own opinion on the matter is gradually shifting toward the arrow.

Another example:

%hash{array_ref} = []; push @{$hash{array_ref}}, 'thingy';

Here the reference is a value in a hash that points to an array which must be dereferenced before being passed to push


Comment on Re: Dereferencing and comment from Camel
Select or Download Code
Replies are listed 'Best First'.
Re: Re: Dereferencing and comment from Camel
by jerrygarciuh (Curate) on Dec 21, 2002 at 04:54 UTC
    Donkey shane!
    jg
    _____________________________________________________
    "The man who grasps principles can successfully select his own methods.
    The man who tries methods, ignoring principles, is sure to have trouble.
    ~ Ralph Waldo Emerson

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (5)
As of 2015-07-31 03:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (274 votes), past polls