|
|
| Welcome to the Monastery | |
| PerlMonks |
Re: How can one call the lowest value of an array by reference?by GrandFather (Cardinal) |
| on Dec 12, 2012 at 10:05 UTC ( #1008475=note: print w/ replies, xml ) | Need Help?? |
|
Trying to maintain parallel arrays in that fashion if fraught with peril. Instead use a data structure where you can treat each data pair as an entity. One way to do that would be to use OO and generate an object for each animal. For the current sample a simple hash will suffice. Consider:
Prints:
Note the use of the reverse lookup hash byValue to ease accessing the animals in sorted order.
True laziness is hard work
In Section
Seekers of Perl Wisdom
|
|
||||||||||||||||||||||