I'm running a query againts 3 seperate databases to extract counts from each and push them into an array. Most people therefore end up appearing 3 times in the array. Is there an easy way to combine like elements in this array such that i get only 1 total for each user or do i need to write my own subroutine to traverse the array and add like elements into a new array?
Note some of the below initials appear more then once. I'm trying to come up with a way that each person appears only once and the count is the total of however many times they appeared in the array.
Note some of the below initials appear more then once. I'm trying to come up with a way that each person appears only once and the count is the total of however many times they appeared in the array.
Code:
for each DB we push onto the array:
while (($UserName, $Role, $RestoreCount) = $sth->fetchrow)
{
push @data, { user => "$UserName" ,
role => "$Role" ,
started => "$RestoreCount" };
}
then we output the array later:
VH Operator 158
AP Supervisor 172
BDM Operator 233
PMJ Engineer 246
JR Operator 294
BDM Operator 341
CC Operator 355
TH Operator 369
MS SysAdmin 375
FAP Supervisor 410
JM Engineer 429
MS SysAdmin 497
DAN Operator 599
FAP Supervisor 608
CS Operator 614
BF Operator 650
JJ Operator 772
JJ Operator 925
PG Operator 1147
RM Operator 1152
JM Operator 1156
CC Operator 1208
JR Operator 1283
TH Operator 1370
TR Operator 1440
FAP Supervisor 1536
EB Operator 1668
KC Operator 1982
DH Operator 2013
VH Operator 4230