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

Re^7: use feature 'postderef'; # Postfix Dereference Syntax is coming in 5.20 (demerphq mistaken?)

by tobyink (Canon)
on Nov 30, 2013 at 13:24 UTC ( [id://1065052]=note: print w/replies, xml ) Need Help??


in reply to Re^6: use feature 'postderef'; # Postfix Dereference Syntax is coming in 5.20 (demerphq mistaken?)
in thread use feature 'postderef'; # Postfix Dereference Syntax is coming in 5.20

The exception would be method calls.

$object->foo() # $-sigil, but does this return a scalar?

Obviously this is bracketed as:

($object)->foo()

... so the sigil does make sense: that particular subexpression returns a scalar. However, the expression as a whole could return a list.

Some people argue that method calls should always return a scalar; if you need to return more than one result, return an arrayref.

use Moops; class Cow :rw { has name => (default => 'Ermintrude') }; say Cow->new->name
  • Comment on Re^7: use feature 'postderef'; # Postfix Dereference Syntax is coming in 5.20 (demerphq mistaken?)
  • Select or Download Code

Replies are listed 'Best First'.
Re^8: use feature 'postderef'; # Postfix Dereference Syntax is coming in 5.20 (demerphq mistaken?)
by ikegami (Patriarch) on Dec 01, 2013 at 17:37 UTC

    Some people argue that method calls should always return a scalar; if you need to return more than one result, return an arrayref.

    Ironically, these are the people who would benefit the most from ->@*.

Log In?
Username:
Password:

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

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

    No recent polls found