http://qs1969.pair.com?node_id=73993


in reply to Sub cannot return an array?
in thread Dereference an array reference

Yes, you are suffering from the all too common "arrays in a scalar context return their size while lists in a scalar context return their last member" syndrome.

If ret_array were returning an array, then you could do array things to it like: push( ret_array(@a), "add" ); which you can't.

So you don't call something an array based on what it returns in a scalar context. The definition of an array in Perl is much narrower than that (an array is a type of variable, not a type of value).

The flip side of this is that there are lots of definitions for "list" going around so you have to be careful to realize which one is being used each time you see the word "list". Feel free to search for more on this topic (I've said plenty on it recently and not so recently). (:

        - tye (but my friends call me "Tye")