this time im unsure about the way to go with something id like to do - quick example of the case:
theres a different number of users in a channel where some of them have been added to a database with personal stats. that means the ones who have been added to the database are also being rated by using numbers like one user has been rated with value 10, another one has been rated with value 200 and so on. now i want to sum up all the rated values which gets me somehow stuck.
usually im reading the values from database and then use foreach to get every value but how do i sum up each value with the value before?
im not sure if using arrays is a good idea, also played with the idea to write every value into a new line of a text file which will be read line for line and then summed up after the foreach part but im sure theres more beautiful solution to this.
please help
Last edited by raider2k on Sun Apr 05, 2009 9:53 am, edited 1 time in total.
set sum 0
#Assume the data is stored in dataset as a list of lists...
foreach item $dataset {
#second item of $item holds the rating...
incr sum [lindex item 1]
}