while ( my ( $name, $code ) = each %hash ) { no strict 'refs'; *$name = $code; } #### if ( my $method = $x->can('blah') ) { $x->$method; }