in reply to Re: Differ. array and List
in thread Differ. array and List

Hope this isn't flogging a dead horse, just wanted to express this in a way that is clear to me.

"Context" in perl means, you have a line of code with a function that returns something, ie an lvalue -- for "left value" because what gets returned is on the left side of the expression. The function can behave differently, depending on what gets returned.

@array = myfunction(); # array or list context (same thing) $array = myfunction(); # scalar context
If it's returning a scalar value it's scalar context, if it's returning an array value it is list context, or array context (same thing).

So, as far as "context" is concerned, array and list are the same thing.

But, there are places where the argument to a function has to be an array and not a list. So something like this could happen:

functionOnlyTakesArrays(@array) # works functionOnlyTakesArrays("one","two","three") # doesn't work
Right? Or wrong?