my @objects = map { My::Object->new() } 1..100; # Give a random 10 object the bar property, skip any where foo is set. for( 1..10 ) { my $object = $objects[ int rand 100 ]; redo if $object->is_foo(); $object->is_bar(1); } # Use the object array in the unit tests.