in reply to Hash Math
This will not be as easy as it first appears. First of all, there is no concept of “previous” or “next” with regards to a hashref. Also, dates can be difficult to manage as hash-key strings. So, do you really need for this to be a hash, or will a simple array/list do just as well?
Guessing that the answer to that question is most-likely, “yes,” I suggest that each list-element should be a hashref which contains both the data-record and the associated date ... storing the latter as a date/time object against which math can easily be done. Now, it is possible to sort that list, using a sort-comparison function that accesses the dates in each record (as the date/time objects that they actually are). It is then possible to iterate through each element in these lists to do whatever comparative processing might be needed.
For lists of reasonable size (and “reasonable size” can easily be human-large ...), functions like grep are handy for currying through the list and retrieving matching entries.
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Hash Math
by marlowvoltron (Novice) on Jun 09, 2014 at 20:36 UTC | |
by Cristoforo (Curate) on Jun 10, 2014 at 02:16 UTC | |
by perlfan (Parson) on Jun 10, 2014 at 14:25 UTC |