On Thursday, June 30, 2005 09:33:23 +0200, Johan Lindstrom 
[SMTP:[EMAIL PROTECTED] wrote:

> This is what I meant when I said a hash is a good solution to this problem.
> You're not really interested in the order, you want to access each element
> by a convenient name.
>
> It sounds like a bit of data to keep in memory, so going from an array to a
> hash may not be feasible because of that, but if it is it would look like
> this instead:
>
> $trade[$i]->{"time_elapsed"}
>
> If your available memory can take this hit, I'd consider that approach a
> lot more maintainable. If not, go with either exported constants or simply
> $UPPER_CASE_VARIABLES as named indices into the array.

I didn't mean to ignore this approach.  I really like it because: 1) The 
symbols are contained in the hash and don't have to be imported. And, 2) It's 
self-documenting (presume this is what you meant by "maintainable) -- very easy 
to read.  The memory may not support this design for this particular array, but 
I will use it on one, maybe two, smaller arrays.  Thank you very much.

> And to me it looks like the solution would be more clear with each record
> being an object, but if you're not familiar with OO, don't start
> introducing it in this program. Try it out with something small and new.
>
> http://www.manning.com/books/conway is excellent.

Thanks for the reference.  I remember Conway as the author of Switch.pm. 
 Should be good.

I appreciate the investment of time and quality of your suggestions.

--Neil


_______________________________________________
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to