in reply to Your favorite objects NOT of the hashref phylum

I don't know if it's the kind of object you're looking for, but I'm very interested in interators:

my $iterator = &foo(); while($iterator->()) { # do something }

The cool part is the way they can be created in Perl:

sub foo { return sub { # some code }; }

Now, you may be asking what's an iterator used for? Iterators can be used instead of arrays when the list in its entirety would use too much memory, or when the list is infinite.

For example, the set of even numbers:

my $even = &even_numbers(1000); while (my $n = $even->()) { print "$n\n"; sleep(1); } sub even_numbers { my $number = shift; $number-- unless ($number % 2); return sub { $number += 2 }; }

I know this is not the most sophisticated example, but you got the idea.

If you want to learn more about iterators, this is a good start point:

http://www.perl.com/pub/a/2005/06/16/iterators.html