Treat the expression giving the name of the variable as a reference.
So if the name is obtained by "specific_${var_name_modifier1}_var" and it's a scalar variable, you want
no strict qw( refs ); ${ "specific_${var_name_modifier1}_var" } = 123; say ${ "specific_${var_name_modifier1}_var" };
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Contain yourselves please: THEORETICAL question about variable values being used as A PART of another variable's name.
by Anonymous Monk on Dec 15, 2016 at 18:37 UTC | |
by stevieb (Canon) on Dec 15, 2016 at 18:41 UTC | |
by LanX (Saint) on Dec 15, 2016 at 19:03 UTC | |
by ikegami (Patriarch) on Jan 13, 2017 at 18:48 UTC |