in reply to Re^3: why lexical variables can not be interpolated?
in thread why lexical variables can not be interpolated?
kennethk
Thank you for your detailed answers to this question.
I know if I use a symbolic reference will get this done. But it will not work for lexical scope variable. If, for example, I use:
my $AGE =17 #instead of $AGE=17
your solution will fail.
It seems to me that it's impossible to use /e to solve this situation when variable is lexical scoped.
Yes, sprintf will work for this case as we know it's a number; but in other cases we may not know if $AGE holds a numeric value.
Any thoughts?
Thank you!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^5: why lexical variables can not be interpolated?
by SuicideJunkie (Vicar) on Oct 21, 2013 at 18:25 UTC | |
by lightoverhead (Pilgrim) on Oct 21, 2013 at 18:54 UTC | |
|
Re^5: why lexical variables can not be interpolated?
by kennethk (Abbot) on Oct 21, 2013 at 18:16 UTC | |
by lightoverhead (Pilgrim) on Oct 21, 2013 at 18:53 UTC |