|Just another Perl shrine|
Date Array Convolutionby alanonymous (Sexton)
|on Nov 03, 2011 at 19:21 UTC||Need Help??|
alanonymous has asked for the
wisdom of the Perl Monks concerning the following question:
Hello, Perl Monks,
I think I have a fairly easy problem, but I'm having problems approaching it. I've completed the portion of code to read in files and parse out the exact data I need, but now I'm having a problem figuring out to convolute my dates.
Essentially I have two arrays, each of which holds a list of another array that has three values. Here is a super simple example of what I am trying to describe:
The format for the inside array is DDTTTT,DDTTTT,V where DD is a two digit date, TTTT is a 24 hour time value, and V is some decimal value.
I need to combine these arrays into a single list, organized by time that does two special things: ***in overlapping dates/times the lower value is chosen which forces some of the items to be split, and also needs to break the value into two for a change in days.***
The solution to the above example would be an array consisting of the following arrays:
The solution to the above is easy and straight-forward to do by hand, but this will have to be done for hundreds+ daily, and perl is perfect for it!
What I'm looking at now is:
I'm not looking for a solution per say, but I really need some help with how to approach the problem. I wouldn't say no to a solution though :) Like I said, I've done the ~30 lines of code to get the data to the point where the fun begins, but that's where I'm having problems