If you use it with indirection as Brandon suggested:
TotalArray(ArrName)
S Total=0
S K=""
F {
S K=$O(@ArrName@(K))
Q:K=""
S Total=Total+@ArrName@(K)
}
Q Total
and then you call it like this
W $$TotalArray("^A")
or even
W $$TotalArray("^A(""someIndex"")")