in reply to Re^2: Return array or list from an XSUB?
in thread Return array or list from an XSUB?

Just a couple of thoughts. It's just a matter of choosing whatever makes the most sense.

If you're returning something that is "really" a long list of items, then returning the number of elements in scalar context (like an array) is a good choice.

If you're returning something that is more like a "main" value plus "additional information" then it may make more sense to return the main value in scalar context.

If you really want to return the same thing in both context, you should just return an array ref.

Replies are listed 'Best First'.
Re^4: Return array or list from an XSUB?
by smee30 (Initiate) on Nov 14, 2007 at 12:57 UTC
    Great - thanks!