P is for Practical | |
PerlMonks |
Re: Configurable comparisonsby Corion (Patriarch) |
on Feb 26, 2002 at 22:20 UTC ( [id://147750]=note: print w/replies, xml ) | Need Help?? |
Tackling this problem via eval is possible with Perl, but it surely is not wise to attack this problem with this tool. I guess you want something like the following, a hand-coded and much gentler version of eval, that only evaluates the intended stuff (untested):
More operators are added easily - you could now turn again to Perl to write these operators for you, but it is better to approach the problem slowly instead of drinking the whole sea at once :-) Of course the above assumes that all your status variables are collected together in a separate hash, as it's a generally bad idea to use symbolic references (see Dominus' homepage for a discussion). If you really really really think you must get at the variable names from within your program, ask that in a separate question.
In Section
Seekers of Perl Wisdom
|
|