I have two fields, say foo and bar . They both have the same format. An example of the fields could be
foo="{a=3, b=4, c=11}"
bar="{x=1, y=5, z=3}"
I want to parse and use these multivalued fields. That is, I want to be able to extract and use a , b ,... and use them in calculations (using eval). Can anyone tell me whether this is even possible, and if it is, how I do it?
If you want to know all of it, what I wish to calculate is this: (a*x + b*y + c*z)/(x + y + z) . In the above example, the result of this calculation would be 7.
Oh, and what makes this even more difficult (I think), is that I might actually have more fields, containing say a , b and c . So, there might as well be the field
baz="{a=23, b=1, c=6}"
I'll have to be sure I don't wind up using these values of a , b and c in the calculation.
... View more