Problems? Is your data what you think it is? | |
PerlMonks |
Re: How can I access object data in a user defined sort cmp function?by LanX (Saint) |
on Jan 28, 2015 at 17:12 UTC ( [id://1114788]=note: print w/replies, xml ) | Need Help?? |
why do you need a custom function byvalue() ? Even sorting the keys of a normal hash by value¹ can only be done by somehow tunneling the reference into byvalue() by closure/currying (like choroba showed) or by doing a (schwarzian?) transform of the hash into an array of key/value-tupels. Both approaches look like overkill if you can do this straightforwardly:
Easy to read, easy to understand. So why ?
PS: downvoted for lack of indentation, I agree with the Guido comment. ¹) hint "Reduction to a simpler problem"!
In Section
Seekers of Perl Wisdom
|
|