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.
In reply to Re: Hash Math
by kennethk
in thread Hash Math
by marlowvoltron
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |