my $obj = Foo->new( sort => 1); ... while (my $val = $obj->next) {