in reply to Re: Differ. array and List
in thread Differ. array and List
"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.
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).@array = myfunction(); # array or list context (same thing) $array = myfunction(); # scalar context
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:
Right? Or wrong?functionOnlyTakesArrays(@array) # works functionOnlyTakesArrays("one","two","three") # doesn't work
|
|---|