in reply to Printing the code of a coderef
A more interesting example:use Data::Dumper; $Data::Dumper::Deparse = 1; my $code = sub { print "hello world\n" }; print Dumper $code; __END__ $VAR1 = sub { print "hello world\n"; };
{ 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"; };
|
|---|