How can I tell if a set of parens in perl code will act as grouping parens or form a list?

Posted by Ryan Thompson on Stack Overflow See other posts from Stack Overflow or by Ryan Thompson
Published on 2010-05-22T02:43:08Z Indexed on 2010/05/22 2:50 UTC
Read the original article Hit count: 376

Filed under:
|
|
|
|

In perl, parentheses are used for overriding precedence (as in most programming languages) as well as for creating lists. How can I tell if a particular pair of parens will be treated as a grouping construct or a one-element list?

For example, I'm pretty sure this is a scalar and not a one-element list: (1 + 1)
But what about more complex expressions? Is there an easy way to tell?

© Stack Overflow or respective owner

Related posts about perl

Related posts about context