I am trying to print name of the input argument inside a sub routineWhat if the input argument doesn't have a name? What do you expect the answer to be in the following cases:
@foo = (10); sub bar {10}; $baz = 5; $qux = 2; @quux = (); $fred = 100 +; print_name 10; print_name \10; print_name ${\10}; print_name [10]; print_name @foo; print_name $foo[0]; print_name bar; print_name $baz * $qux; print_name; print_name undef; print_name @quux; print_name sqrt $fred; print_name do {my $waldo = 10}; print_name sub {10}->();
In reply to Re: To print name of a scalar
by JavaFan
in thread To print name of a scalar
by l33t
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |