in reply to possible to evaluate scalars stored in a string?
I think that you have answered your question for yourself. What do I mean by that?
"Some of the parameters are stored elsewhere in the script as scalars and would need to be evaluated at the time of use."
That's what eval is for! It evaluates things at run time. I'm thinking the last line should be: system(eval{$hash{command1}});
But I did not test it, YMMV, objects in mirror may be closer than they appear, any bit rot caused by using this is to be blamed upon alpha particles and not me.
Updated the code snippet (eval needed braces and not parentheses). I did test it, but as always: YMMV, objects in mirror may be closer than they appear, any bit rot caused by using this is to be blamed upon alpha particles and not me.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: possible to evaluate scalars stored in a string?
by emilford (Friar) on Dec 13, 2003 at 03:50 UTC | |
by tachyon (Chancellor) on Dec 13, 2003 at 04:17 UTC | |
by etcshadow (Priest) on Dec 13, 2003 at 05:03 UTC | |
by tachyon (Chancellor) on Dec 13, 2003 at 05:07 UTC | |
by Mr. Muskrat (Canon) on Dec 13, 2003 at 04:04 UTC |