Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling

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?

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

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (6)
As of 2021-04-20 22:57 GMT
Find Nodes?
    Voting Booth?

    No recent polls found