Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
I have an overloaded object that can perform basic arithmetic:
$one=new Array_Like_Object(1); #set all elements to one<br> $two=new Array_Like_Object(2); #set all elements to two $three = $one + $two;
To set and read elements from this object I have a few simple methods:
$three->Read(14); #return element 14 $three->Write(14,3); #set element 14 to 3
I had assumed that in conjunction with tie, I could do something like:
$three(14); #return element 14 $three(14)=3; #set element 14 to 3
but I can't seem to get it to work. Would this kind of syntax be possible using a tied array?
Thanks.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: An overloaded object and tie
by eclark (Scribe) on Jun 09, 2004 at 18:02 UTC | |
by Anonymous Monk on Jun 09, 2004 at 19:17 UTC | |
|
Re: An overloaded object and tie
by adrianh (Chancellor) on Jun 09, 2004 at 20:01 UTC |