Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re^5: If you believe in Lists in Scalar Context, Clap your Hands

by JavaFan (Canon)
on Oct 24, 2008 at 00:41 UTC ( #719211=note: print w/ replies, xml ) Need Help??


in reply to Re^4: If you believe in Lists in Scalar Context, Clap your Hands
in thread If you believe in Lists in Scalar Context, Clap your Hands

The difference between

$s1 = ($x, $y) = 0..11;
and
$s2 = ($x, $y)
is that $s1 gets assigned the result of the list assignment operator, and $s2 gets assigned the result of the scalar comma operator. In neither case there's a list assigned to any of the $s? variables; in both cases the result of operators are assigned.

But as long as you keep believing in the existence of lists in scalar context, you'll keep being confused.


Comment on Re^5: If you believe in Lists in Scalar Context, Clap your Hands
Select or Download Code
Replies are listed 'Best First'.
Re^6: If you believe in Lists in Scalar Context, Clap your Hands
by gone2015 (Deacon) on Oct 24, 2008 at 02:10 UTC
    But as long as you keep believing in the existence of lists in scalar context, you'll keep being confused.

    Up to a point.

    $s1 = ($x, $y) = 0..11;
    is explained by reference to the definition, which refers to the Scalar Context effect on the assignment, independent of the list being assigned to.

    This piece of magic cannot be understood either as a List in Scalar Context or as a Scalar Context ',' operation.

    Apples and pears wise, what we have here is a banana.

      And they're all bananas. Which is a much simpler way to understand it all. :)

      - tye        

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (6)
As of 2015-07-30 06:12 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (270 votes), past polls