J
Justin C
I have a hash containing stock codes (the keys) and the number of units
sold (the values). I can sort them easily to give the best selling items
at the top and those that sold the fewest at the bottom. There are many
items with the same number of units sold, what I'd like to do is sort
the keys within there relevant position in the in the list.
Here is an example of the data I have:
Code Qty
ABZ001 13
ADF001 7
ADF002 6
ADF003 6
ADF004 6
ABZ002 5
ABZ003 5
ABZ120 4
ABZ047 4
ABZ022 4
ADF027 4
ADF019 4
What I'd like to have is within those items that have sold 4 units they
be sorted asciibetically.
The sort I have for the hash so far is:
foreach ( sort { $sales{$b} <=> $sales{$a} } keys %sales) {
print "$_;\t$sales{$_}\n";
}
Thank you for any help you can give with this.
Justin.
sold (the values). I can sort them easily to give the best selling items
at the top and those that sold the fewest at the bottom. There are many
items with the same number of units sold, what I'd like to do is sort
the keys within there relevant position in the in the list.
Here is an example of the data I have:
Code Qty
ABZ001 13
ADF001 7
ADF002 6
ADF003 6
ADF004 6
ABZ002 5
ABZ003 5
ABZ120 4
ABZ047 4
ABZ022 4
ADF027 4
ADF019 4
What I'd like to have is within those items that have sold 4 units they
be sorted asciibetically.
The sort I have for the hash so far is:
foreach ( sort { $sales{$b} <=> $sales{$a} } keys %sales) {
print "$_;\t$sales{$_}\n";
}
Thank you for any help you can give with this.
Justin.