T
Tomasz Chmielewski
I have a couple of variables, like:
my $thing_added = "test1";
my $otherthing_added = "test2";
I also have an array:
@array = ("thing", "otherthing", "no_such_variable");
Now, I would like to go through every element in the array, and check if
there is a corresponding "<array_element>_added" variable.
For example, for "thing", I would like to check if there is a
$thing_added variable. This should evaluate true, as I defined that
variable earlier.
Similarly, for "otherthing", I would like to check if there is a
$otherthing_added variable. This one should also evaluate true.
For "no_such_variable" element, a check for $no_such_variable_added
should evaluate false, as this variable was not defined.
I tried using "eval" to construct a variable out of yet another variable
value and a "_added" word, but haven't been successful.
Any hints?
my $thing_added = "test1";
my $otherthing_added = "test2";
I also have an array:
@array = ("thing", "otherthing", "no_such_variable");
Now, I would like to go through every element in the array, and check if
there is a corresponding "<array_element>_added" variable.
For example, for "thing", I would like to check if there is a
$thing_added variable. This should evaluate true, as I defined that
variable earlier.
Similarly, for "otherthing", I would like to check if there is a
$otherthing_added variable. This one should also evaluate true.
For "no_such_variable" element, a check for $no_such_variable_added
should evaluate false, as this variable was not defined.
I tried using "eval" to construct a variable out of yet another variable
value and a "_added" word, but haven't been successful.
Any hints?