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 -> ( @arguments ); }