in reply to Hash Math
First, I would suggest using ISO_8601 as your date format, since this sorts easily. For the date arithmetic, I would suggest using a module to do the math, since dealing with days-of-month variation is an unnecessary headache. DateTime is a common choice for that. You could implement the looping component using two nested loops, a la:
for my $time1 (sort keys %hash) { for my $time2 (sort keys %hash) { next if $time2 < $time1; ... # And do the math } }
#11929 First ask yourself `How would I do this without a computer?' Then have the computer do it the same way.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Hash Math
by marlowvoltron (Novice) on Jun 09, 2014 at 20:59 UTC | |
by kennethk (Abbot) on Jun 09, 2014 at 23:40 UTC |