Clear questions and runnable code get the best and fastest answer |
|
PerlMonks |
Re: hash sortby johngg (Canon) |
on May 31, 2017 at 17:45 UTC ( [id://1191743]=note: print w/replies, xml ) | Need Help?? |
The one-to-one correspondence of the %hash1 and %hash2 keys makes me a little suspicious, where is the point of having both hashes if that's the whole of the data? I'm going to hazard a guess that %hash2 is larger than %hash1, the latter being used to select a sample from the former. I call them %data and %pick in the script below which uses rand to generate the data (and srand so that it is consistent between runs).
The output.
I hope this guess bears some relation to the real problems and is helpful. Update: A perhaps more readable alternative to the "skip one - read four - skip back five - read one" unpack template would be this:-
Cheers, JohnGG
In Section
Seekers of Perl Wisdom
|
|