Hello Monks,
I have an array with 20 subrefs. I go through each element of the arrray and execute the subroutine. Sometimes, I have to remove a few subrefs from the array and run my program. As a result, I find it hard to trace the name of the subroutine currently running. My code looks like:
my @tests = (\&test1,\&test2,\&test3,&test4); # 20 odd refs here
my $test = 1;
foreach my $subref (@tests) {
print STDERR "Test # $test++\n";
foreach my $size (1..1000) {
$subref->($arg1,$arg2,$size);
}
}
As you can see, each time I change the elements of the array, the test # printed on STDERR is different from the subroutine that is actually running.
Is there a way I can obtain the name of the subroutine currently running? (like test1, test2 etc.).
Thanks!