http://www.perlmonks.org?node_id=1011020


in reply to Re^5: join all elements in array reference by hash
in thread join all elements in array reference by hash

Thanks for your prompt response and patience/wisdom. I didn't expect so many quick and detailed responses during the Christmas season. I've broken down my exceedingly long 300 lines or so into several subroutines to make for better readability.

I found the answer to my memory problems - "make an anonymous copy" via a post from Randal Shwartz. At: http://www.stonehenge.com/merlyn/UnixReview/col30.html. I basically needed to put [] around my @verses array so that I create a copy of it when I point my hash reference there.

In terms of the foreach stylistic point (@{$bible...), that was sort of the syntax I was looking for for my join, but my issue had been that I had an empty array. Would not the following be even cleaner? Comments on efficiency?

print join("\n\n",@{$bible{$qbook}{$chapter}{'verses'}});
That seems to be working for me now. I may have future questions regarding my little project but now I have some experience regarding "too little" and "too much" so I'll try to ensure I follow your advice of making it "just right" and using <readmore> as appropriate.