![]() |
|
Welcome to the Monastery | |
PerlMonks |
Re^2: How can I create an iterator that works inside foreach() (updated)by PUCKERING (Sexton) |
on Nov 05, 2022 at 02:24 UTC ( #11147977=note: print w/replies, xml ) | Need Help?? |
Brilliant!!! The & prototype was the secret sauce! Thank you so much for your help.
I'm embarrassed to see that it was on page 123 of High Order Perl and I missed it. An example with a foreach would have helped -- but MJD did such an awesome job with a lot of complicated topics in that book that there's no way I'm going to complain! I should have read the chapter more carefully. There's a web site called programming-idioms.org which provides a database of idioms implemented in different languages for easy comparison. The reason I asked about this is that I made a contribution to the idiom for generator functions but after additional testing realized it didn't work in a foreeach loop. I'll use your suggestion to update it. Here's a link to the programming idioms page I'll be modifying: Idiom #319 generator functions
In Section
Seekers of Perl Wisdom
|
|