What do you get by returning an iterator that you don't get by returning an array or an arrayref?
The only thing I can think of is that you can call a "next" method that is non-destructive (unlike shift which is destructive to the array). If you return an array you could just return a copy if you don't want the recipient to destroy your array, but that would be ineficient for large arrays.
In reply to Re: Return a list or an iterator
by aufflick
in thread Return a list or an iterator
by nferraz
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |