Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Counting unique elements

Status
Not open for further replies.

Deleted

Technical User
Jul 17, 2003
470
US
Don't know if anyone can help me with this. :0

Question:

I have an array that looks like this.

my @cart_data = (
'298|3042|1|7.99|0.00|0|0|11',
'298|3042|1|7.99|0.00|0|0|11',
'298|3042|1|7.99|0.00|0|0|11',
'298|3042|1|7.99|0.00|0|0|11',
'298|3042|1|7.99|0.00|0|0|11',
'298|3042|1|7.99|0.00|0|0|11',
'298|3042|1|7.99|0.00|0|0|11',
'298|3042|1|7.99|0.00|0|0|11',
'298|3042|1|7.99|0.00|0|0|11',
'298|3042|1|7.99|0.00|0|0|11',
'298|3042|1|7.99|0.00|0|0|11',
'298|3042|1|7.99|0.00|0|0|11',
'298|3042|1|7.99|0.00|0|0|11',
'298|3042|1|7.99|0.00|0|0|11',
'299|3045|1|14.99|0.00|0|0|11',
'299|3045|1|14.99|0.00|0|0|11',
'299|3045|1|14.99|0.00|0|0|11',
'299|3045|1|14.99|0.00|0|0|11',
'299|3045|1|14.99|0.00|0|0|11',
'1619|8173|1|6.99|0.00|0|0|9',
'1619|8173|1|6.99|0.00|0|0|9',
'1619|8173|1|6.99|0.00|0|0|9',
'2364|1410B|1|1.49|0.00|0|0|5',
);

What I am looking to do is get the total of each unique group

Example Result:

Group 11 has 19
Group 9 has 3
Group 5 has 1

-----

Thanks in advance
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top