[Bioperl-l] Adding all elements from an array of scores

francois fauteux ffauteux at gmail.com
Sat Aug 19 12:49:57 EDT 2006


Having an array of alignment scores:

@scores = ('x1', 'x2', 'x3', 'xn')

Where x1, x2...xn are the score values and n is the number of elements
in the array;

How could I add the values x1 + x2 + x3 + ...xn (would have to adapt
to arrays of variable number of elements);

It would look like 'add $score[1] + $score[2] ... and so on until
there is no more elements in the array';

Thanks for hints;

François Fauteux

More information about the Bioperl-l mailing list