in reply to multiple consumer of an array

I definitely agree with AppleFritter: take a look at Mark-Jason Dominus's absolutely brilliant book, Higher Order Perl, Transforming Programs with Programs (available on line: http://hop.perl.plover.com/book/).

The whole book, or almost, is about composing functions the way you want, but Chapter 4 about Iterators is probably the most relevant to what you are doing (except that you probably need to read at least in part the preceding chapters to fully understand chapter 4).