Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re^4: Some Insights from a Traveler Between Languages

by ihb (Deacon)
on Apr 26, 2005 at 22:09 UTC ( #451784=note: print w/replies, xml ) Need Help??


in reply to Re^3: Some Insights from a Traveler Between Languages
in thread Some Insights from a Traveler Between Languages

Does the parenthesis in (EXPR) x EXPR create a list (in list context)?

ihb

See perltoc if you don't know which perldoc to read!

Replies are listed 'Best First'.
Re^5: Some Insights from a Traveler Between Languages
by Roy Johnson (Monsignor) on Apr 26, 2005 at 22:58 UTC
    It creates list context for the x operator, which causes a list to be created.

    Caution: Contents may have been coded under pressure.

      It creates list context for the x operator

      Nope. The operand of any operator can't set which context the operator itself is in. It does set context for it's operand though. That's what's interesting. Illustration for those that don't know what Roy and I are talking about:

      sub context { print defined wantarray ? wantarray ? 'list' : 'scalar' +: 'void' } @foo = context() x 1; # "scalar" @foo = (context()) x 1; # "list"

      ihb

      See perltoc if you don't know which perldoc to read!

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (5)
As of 2020-10-30 20:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My favourite web site is:












    Results (284 votes). Check out past polls.

    Notices?