#The same perl complaint is generated in the above code too C:\Documents and Settings\m>perl - sub testit{ print 'hi' };; sub doit (&) { $_[0]->() };; my $codeRef = \&testit;; doit( $codeRef );; __END__ Type of arg 1 to main::doit must be block or sub {} (not private variable) at - line 4, near "$codeRef )" Execution of - aborted due to compilation errors.