A
Abhinav
Hi,
I have the following piece of code which checks for a word within <> .
What I want to do is, if this matches, I want to change the value of a
variable, which is having an integer value, and whose name is same as
the matched string, to 1.
Thus, if i match <x>
I need to do
$x = 1 ;
Is there any way i can use the value of the matched text ($1) to create
the variable name ?
The code is :
if (/<(\w+)>/)
{
# What to put here , so that the corresponding variable gets declared
# and initialized ?
#something like,
my '$'.$1 = 1 ; # I know it is wrong, but just to signify what i want ..
}
Thanks
AB
I have the following piece of code which checks for a word within <> .
What I want to do is, if this matches, I want to change the value of a
variable, which is having an integer value, and whose name is same as
the matched string, to 1.
Thus, if i match <x>
I need to do
$x = 1 ;
Is there any way i can use the value of the matched text ($1) to create
the variable name ?
The code is :
if (/<(\w+)>/)
{
# What to put here , so that the corresponding variable gets declared
# and initialized ?
#something like,
my '$'.$1 = 1 ; # I know it is wrong, but just to signify what i want ..
}
Thanks
AB