I looking for a function (or any other way) that returns the string 'main::my_sub' if i pass a reference to my_sub. Is there any way to realize this?sub my_sub { print "hello\n"; } my $var = 5; my $subname = some_nice_function(\&my_sub); # should return 'main::my_ +sub' my $varname = some_nice_function(\$var); # should return '$var' or 'va +r'
In reply to How to get the name from a reference by michi
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |