my %constructors = ( "One" => \&One::new, "Two" => \&Two::new ); sub factorish { my ( $type, @arguments ) = @_; my $consref = $constructors{ $type } or die "No handler for $type."; return $consref -> ( $type, @arguments ); }