Perl Monk, Perl Meditation | |
PerlMonks |
Re^2: Return a list or an iteratorby Anonymous Monk |
on Apr 17, 2006 at 18:56 UTC ( [id://543890]=note: print w/replies, xml ) | Need Help?? |
The safe way to handle undefs as a valid element is to have the iterator return one element in list context and an empty list if there's no elements, and then always call it in list context when iterating over it.
This way you don't need it to be an object and you don't need any special end-of-list elements.
In Section
Meditations
|
|