in reply to listing the first occurance of file by date

Yes there is a simple way. When is the homework assignment due?

Seriously though, look at File::Find to traverse the file tree. Keep track of the path to the file with the youngest offset from midnight as you traverse the tree. Each time you come across a file with a smaller "since midnight" offset than the one you were keeping track of, hold onto the new one instead, and continue traversing the tree. When you're done, you'll have your suspect.

For the first file of each day, you can build a hash where the key is the time (in 'time' time, ie, seconds since epoch) of midnight for each day a file is found. The value of the hash entry will be an anonymous hash whos first key is "offset" and second key is "file path".

As you parse the directory tree, you take each file, find its base date (time in seconds since epoc at midnight), determine its offset from that time, see if a key containing that base date exists. If not, create a new record. If it does already exist, compare the offset for the existing record with the offset of the new record. If you have a smaller offset in your hand, put it in place of the one you previously had in your pocket, and continue your walk.

The data structure could look like this:

HASH{DATE=>{OFFSET=>seconds_since_date, PATH=>file_path}, DATE=>{OFFSET=>seconds_since_date, PATH=>file_path}, DATE=>{OFFSET=>seconds_since_date, PATH=>file_path} }

Where DATE (the key itself) is the time in seconds of midnight of the date in question.

That ought to get you started. All that's left now is the detail work...

Dave

"If I had my life to do over again, I'd be a plumber." -- Albert Einstein