my $temp_obj = "Foo::$type"->new(); # or, a more verbose version: no strict 'refs'; # because this isn't very strict my $temp_obj = &{"Foo::${type}::new"}("Foo::$type");