Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re^2: Differ. array and List

by tphyahoo (Vicar)
on Apr 26, 2005 at 14:27 UTC ( #451588=note: print w/replies, xml ) Need Help??


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?

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (8)
As of 2020-01-28 20:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Notices?