in reply to Did I get what I expected (an array)?
Also, in your title, you suggest that you want the function to return an array, but in the text, you talk about returning a list. A list, and not a scalar. But this is very confusing. First, a function can not return an array. A function returns either a scalar, or a list. What it returns is determined by the context, and the context alone. A scalar will be returned in scalar context, and a list will be returned in list context. The return @x in the test function never returns an array - it returns a scalar in scalar context, and a list (consisting of the elements of @x) in list context.
BTW, what is your fear of modules?
Abigail
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Did I get what I expected (an array)?
by Anonymous Monk on Jul 16, 2002 at 16:35 UTC | |
by Abigail-II (Bishop) on Jul 16, 2002 at 17:31 UTC | |
by bronto (Priest) on Jul 17, 2002 at 08:21 UTC |