P
Peng Yu
Hi,
I try to use Dumper to print a hash which has a function ref as one of
its value. But I only can get "sub { "DUMMY" }", which is not helpful
for me to know what this function is. Is there a way to somehow print
the function body?
~/linux/test/perl/library/Data/Dumper/Dumper$ cat main_fun.pl
#!/usr/bin/perl
use strict;
use warnings;
use Data:
umper;
sub f {
return 0;
}
my %hash_of_arrays = (
a => \&f,
);
print Dumper(\%hash_of_arrays);
~/linux/test/perl/library/Data/Dumper/Dumper$ ./main_fun.pl
$VAR1 = {
'a' => sub { "DUMMY" }
};
Regards,
Peng
I try to use Dumper to print a hash which has a function ref as one of
its value. But I only can get "sub { "DUMMY" }", which is not helpful
for me to know what this function is. Is there a way to somehow print
the function body?
~/linux/test/perl/library/Data/Dumper/Dumper$ cat main_fun.pl
#!/usr/bin/perl
use strict;
use warnings;
use Data:
sub f {
return 0;
}
my %hash_of_arrays = (
a => \&f,
);
print Dumper(\%hash_of_arrays);
~/linux/test/perl/library/Data/Dumper/Dumper$ ./main_fun.pl
$VAR1 = {
'a' => sub { "DUMMY" }
};
Regards,
Peng