in reply to Re: Re: Confessions of an Initiate: a first Perl program
in thread Confessions of an Initiate: a first Perl program
Not to sound cliche or anything, but you must first understand the cause of the problem; then the solution will become obvious. The reason the popup ordering isn't in order is because it is gotten through keys %some_hash -- which, as we know, produces said keys in no (easily) predictable or useful order. While it is possible that one could attempt to re-sort the list that it returns into some useful order, the current date format looks to make that rather hard.
Given that, what we really want is to keep track of the keys of the hash as we add them, in some structure which preserves order -- say, like an array or something..
Thus, we do is have an @dates array (declared next to where we define %quotas, say), and push $period onto the end of @dates as we go though loading the data. Later on, we can use @dates instead of keys %quotas if the ordering matters.
I've intentionally not provided much explicit code here. Consider it an "excercise left to the reader." ;>
perl -pe '"I lo*`+$^X$\"$]!$/"=~m%(.*)%s;$_=$1;y^`+*^e v^#$&V"+@( NO CARRIER'