|Syntactic Confectionery Delight|
comparing and removing values from an array of hashesby rizzler (Novice)
|on Oct 22, 2012 at 13:53 UTC||Need Help??|
rizzler has asked for the
wisdom of the Perl Monks concerning the following question:
Hi guys, I have an issue that needs to be solved as part of my perl code and I feel i am in over my head. Any help would be greatly appreciated. I have an array of hashes and I need to compare the values in these arrays and based on several criteria only keep 1 of the arrays.
Here is an example of whats in my array:
I need to compare the values in the array, maybe sort them on the following criteria, Here is my criteria:
1. Is there a value in check.
2. what value has the longest duration, this is in field duration and I need to keep MONTH over WEEK over DAY.
3. Which has the highest value in quantity.
4. which has the highest price.
I need then remove all the values to just be left with the array that best matches the criteria.In this case I should only be left with B.
Thanks in Advance.