package NHB::QuizMaster::Quiz; sub make_question { my $s = shift; my $type = ref $s; # X::Y::Z::Quiz $type =~ s/::Quiz$/::Question/; my $question = new $type; ...etc }