use strict; use warnings; my $self = bless {tests => [qw(something else another bogus)]}; for my $testName (@{$self->{tests}}) { my $test = $self->can ("test_$testName"); if (! $test) { warn "Test $testName not available\n"; next; } print "Running test $testName:\n"; $test->($self); } print "Testing complete\n"; sub test_something { print "something\n"; } sub test_else { print "something else\n"; } sub test_another { print "another unimaginative statement\n"; } #### Running test something: Test bogus not available something Running test else: something else Running test another: another unimaginative statement Testing complete