in reply to Re^2: returning tied array
in thread returning tied array

If you return a list from a subroutine, then you get that list back. If it was in scalar context, then you only get the first item of the list.

You can use wantarray to see what context you were called in.

Update: s/\barray\b/list/g per chromatic's comment.

Replies are listed 'Best First'.
Re^4: returning tied array
by chromatic (Archbishop) on Jan 08, 2007 at 04:52 UTC

    You can only return scalars and lists and (nothing) from subroutines. You can't return arrays or hashes directly, only as lists or references.

      Good point. I updated my above post to correct that.