Sort of. The sub is getting run, or the print statement wouldn't be executed. But you're not doing quite what you're trying to do with the higher-order stuff. Your outer sub returns the inner sub, but you aren't assigning it to anything, just executing it. You never call it directly. So you might as well just use an ordinary subroutine.
To return an inner sub and call it later, you do something like this:
sub get_a_processor {
# will return a reference to a sub that processes
return sub {
# your processing stuff
}
}
my $processor = get_a_processor(); # $processor points to inner sub
$processor->($TABNAME); #calls the inner sub on $TABNAME
|