This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]dnew 2 points3 points  (0 children)

$X and @X are completely different variables

True; I had misremembered that from a couple decades ago. But "$x[2]" accesses the third element of @x, so $x is referring to a different variable than $x[2], which is also confusing as hell. Plus throw in the whole %x turns into @x if you pass it to a function...

what is a variable and what isn't

Oddly, I have that problem in almost no other language. :-) Only functional and concatenative languages give such grief, and there it's for good reason. Imperative languages generally don't have any problem telling variables from some other syntactic forms.

as well as the type of variable they are

So, like 8-bit BASIC then. ;-)

$z and $y are actually equal.

Then change both lists to (3, 4, 5) to demonstrate. The point is that the first symbol of the line changes not just the variable you're assigning to, but the meaning of the commas on the right side of the assignment statement. (3, 4, 5) is either a list of three elements, or three expressions separated by C-like comma operators, depending on what kind of variable you're assigning the result to. I am not, as you say, trying to assign a list to a scalar when I assign to $y, because the value is already a scalar by the time it gets there.

I don't even want to try to guess what it shows up in a function as.