sub testit{ print 'hi' };; sub doit (&) { $_[0]->() };; $codeRef = \&testit;; doit( $codeRef );; Type of arg 1 to main::doit must be block or sub {} (not scalar dereference)