Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: Not understanding the arrow operator

by morgon (Priest)
on May 18, 2009 at 20:27 UTC ( [id://764720]=note: print w/replies, xml ) Need Help??


in reply to Not understanding the arrow operator

explain what is going on with the arrow in this context, when nothing is being dereferenced
As already explained above, you are in fact dereferencing $_ which in the context of your map is a reference to a hash.

the arrow operator, which I though was just for class methods and deferencing
Here's a summary to avoid total confusion:

There are 3 cases where the array dereferences:

- $arrayref->[0];
- $hashref->{"key"};
- $coderef->("argument");

Then there are two cases for method calls:

- $object->method; # passes $object as first argument
- SomePackage->method; # passes "SomePackage" as first argument

hth

  • Comment on Re: Not understanding the arrow operator

Replies are listed 'Best First'.
Re^2: Not understanding the arrow operator
by JavaFan (Canon) on May 18, 2009 at 21:04 UTC
    There are 3 cases where the array dereferences:
    Of your three examples, only the first one has anything to do with arrays.
      Hardly any dereference between arrow and array :-)

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (5)
As of 2024-04-16 17:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found