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

Re: $obj->method v.s. $obj->method()

by Bloodnok (Vicar)
on May 10, 2009 at 00:48 UTC ( [id://763093]=note: print w/replies, xml ) Need Help??

in reply to $obj->method v.s. $obj->method()

Your assertion, regarding the difference between $f; and &f();, doesn't ring quite true - consider
sub frobnicate { &foo; &bar(); }
The statement &foo; calls foo using a mirror image of @_ i.e. as passed to frobnicate - whereas, as you point out, &bar() calls bar with an empty argument list - but neither call i.e. to foo() or bar(), modifies @_ as passed to frobnicate.

A user level that continues to overstate my experience :-))

Replies are listed 'Best First'.
Re^2: $obj->method v.s. $obj->method()
by lodin (Hermit) on May 12, 2009 at 00:35 UTC

    The statement &foo; calls foo using a mirror image of @_ /.../ neither call /.../ modifies @_ as passed to frobnicate

    By "mirror image" you mean the same, right? Just to be clear, the call &foo; may actually modify frobnicate's @_.

    See Re^2: Using & in function calls (&foo != foo(@_)) for an example.


Log In?

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

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (4)
As of 2024-05-25 19:35 GMT
Find Nodes?
    Voting Booth?

    No recent polls found