in reply to array of arrays

perlintro, perlreftut, Generation of an ARRAY OF ARRAYS
$ perl -F'\|' -nale '$x[$F[0]-1]+=$F[1]}{print"the total is: ($_)"for@ +x' input.txt the total is: (150) the total is: (75) the total is: (55)
You might need different quoting on -F depending on your shell. Add option -MO=Deparse to see the longer code