From: Bruce W. <br...@mi...> - 2000-05-17 13:52:47
|
From the mis-spoken Bruce: >Yep, $serial is a scalar (that is a pointer to the object data), so I think >you can use it as an index to your own hash array for whatever you want to >do. That is what I do with the '%menu_items_by_object' array in mh. From the wiser Frank: > References used as hash keys are converted to strings, and can't be > converted back. You can use Tie::RefHash or some other > indirection mechanism if this functionality is necessary. Frank be right. I had forgotten that detail. You CAN use an object as an index (as I do in that mh %menu_items_by_object array), but you can not then use the index of that array as an object again. If you are simply trying to loop thru a set of objects, a cleaner approach would be to store a list array of objects. For example: $serial1 = new Serial_Item(...); $serial2 = new Serial_Item(...); my @serials = ($serial1, $serial2); for my $object (@serials) { set $object 1; } Bruce |