Part of your problem is to fine the newest and oldest file. Let's try that: perl find newest file in directory. The first hit already explains how to get the newest or oldest file.
Curious as I am (because I've no clue how to find the 'newest' file, or even how to define what the 'newest' file is), I clicked on the link. I somewhat expected to find how to find the file which was modified last (which, BTW, is something totally different from "newest"). But not even that. For me, the first link explained how to find the largest file, for the second link, I couldn't even figure out what the question was, or whether there was an answer, and the third link wanted me to sign up before even revealing an answer. The fourth link tells me about the standard file tests in Perl, but Perl doesn't have a standard test for the age of a file. The fifth link (to Perlmonks) claims to find the oldest file in a directory, but what it really does is to find a file whose inode was last modified the longest time ago. The sixth link lists a couple of modules related to file manipulation - if the answer is in one of the listed modules, then it doesn't say so (but I doubt any of them does). After the sixth, I only scanned the titles of the pages, but none suggested to answer the question.
To me it also appears like magic that Google works for me, but not for you.
Your Google must be better than mine. Do you have the Platinum account?

In reply to Re^4: File creation and last modifiication time by JavaFan
in thread File creation and last modifiication time by mecrazycoder

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.