hotshot has asked for the wisdom of the Perl Monks concerning the following question:
Actually, on runtime I have a regexp, something like:# if I have: $name = 'newVar'; I would like somehow to have a new variable $newVar
and I want to store something in an array by the name stored in $1 (from the regexp) under the index $2 (from the regexp too), the thing is that if the array doesn't already exist, I want to create it on the spot (and initialize it's $2 index). B.T.W. I don't have the names of the arrays in advance, otherwise I would have predefined them.$tmp =~ /(.+)(\d+)$/;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: defining a new var on the spot
by davorg (Chancellor) on Dec 11, 2001 at 18:33 UTC | |
|
Re: defining a new var on the spot
by merlyn (Sage) on Dec 11, 2001 at 21:51 UTC | |
|
Re: defining a new var on the spot
by MZSanford (Curate) on Dec 11, 2001 at 18:30 UTC | |
|
Re: defining a new var on the spot
by mirod (Canon) on Dec 11, 2001 at 18:43 UTC | |
|
Re: defining a new var on the spot
by andye (Curate) on Dec 11, 2001 at 18:42 UTC | |
|
Re: defining a new var on the spot
by strat (Canon) on Dec 11, 2001 at 18:33 UTC |