l33t has asked for the wisdom of the Perl Monks concerning the following question:
Is it possible to get name of scalar in Perl or is it only for Typeglob.my $var = 10; sub print_name{ *glob = \$_[0]; print "Name of the variable ".*{glob}{NAME}."\n"; } print_name $var; Output: glob Expected output: var
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: To print name of a scalar
by syphilis (Archbishop) on Dec 18, 2010 at 06:50 UTC | |
|
Re: To print name of a scalar
by davido (Cardinal) on Dec 18, 2010 at 12:18 UTC | |
by l33t (Initiate) on Dec 20, 2010 at 17:59 UTC | |
|
Re: To print name of a scalar
by JavaFan (Canon) on Dec 18, 2010 at 14:02 UTC | |
by l33t (Initiate) on Dec 20, 2010 at 18:13 UTC |