On Mon, Aug 20, 2001 at 12:21:29PM -0400, Yacketta, Ronald wrote:
> avg1 = (value1 + values2..11) / 10
> avg2 = (value2 + values3..12) / 10
> avg3 = (value3 + values4..13) / 10
>
> the math is the easy part, how would I go about cleanly and efficiently
> running through a has and doing the above?
A hash is not the appropriate data structure for this, an array is. Adding
all of the elements of an array is pretty straightforward: iterate over the
array one element at a time, add that element to a total.
Your "(value1 + values2 .. 11)" syntax can easily be duplicated using
slices, e.g. @values[1..11].
Michael
--
Administrator www.shoebox.net
Programmer, System Administrator www.gallanttech.com
--
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]