in reply to To print name of a scalar
Lexicals ('my' variables) aren't in the global symbol table. They don't appear in the %:: special variable's structure either (for the same reason). If it were a global via our, use vars, or non-adherence to use strict, then it does show up in the global symbol table, and can be referenced through %::. But even that is a little awkward. You don't really know by snooping in %:: when or where the variable first shows up in the script.
I'm not sure what you're after, but could you use a tied scalar so that you're able to create a class of scalar that knows its name by object method?
Dave
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: To print name of a scalar
by l33t (Initiate) on Dec 20, 2010 at 17:59 UTC |