in reply to To print name of a scalar
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}->();
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: To print name of a scalar
by l33t (Initiate) on Dec 20, 2010 at 18:13 UTC |