in reply to Printing the code of a coderef

You can also try using Data::Dumper... just set $Data::Dumper::Deparse to true.
use Data::Dumper; $Data::Dumper::Deparse = 1; my $code = sub { print "hello world\n" }; print Dumper $code; __END__ $VAR1 = sub { print "hello world\n"; };
A more interesting example:
{ package foo; use strict; sub get_coderef { sub { print "hello world\n" } } } use Data::Dumper; $Data::Dumper::Deparse = 1; print Dumper(foo->get_coderef); __END__ $VAR1 = sub { package foo; use strict 'refs'; print "hello world\n"; };