I am trying to figure out what exactly is being processed in this simple statement:
sub testReturn {
return sub {
my $val = shift;
return $val;
}
}
when
my $num = testReturn(1);
print $num;
is called, it outputs:
CODE(0x9c63b34)
When I am trying to have it simply return the value of 1. Thank you.
Your function returns another function as an anonymous code block.
You can call that code to do some things for you, like this: