good chemistry is complicated, and a little bit messy -LW |
|
PerlMonks |
Re: Storing variable coordinates in a matrixby jettero (Monsignor) |
on Mar 16, 2007 at 19:29 UTC ( [id://605207]=note: print w/replies, xml ) | Need Help?? |
What you really want is for each element of your matrix to be dynamically calculated — like a spreadsheet. You need to overload the way perl indexes the matrix. For that, you want Tie::Array, actually Tie::StdArray in particular. Then just alter the way the package works to suit your needs. In this case, you want to store expressions at each index and evaluate them on the fly. I admit to thinking that wasn't possible in perl for a couple days, but tye straightened me out (ironically/punny) in the CB. I felt rather foolish about it actually.
-Paul
In Section
Seekers of Perl Wisdom
|
|