Hello rahu_6697,

Welcome to the Monastery. From my point of view I would approach the problem a bit differently. I would use stat to get each file latest updated date, sample:

my $modtime = (stat($fh))[9]

As a second step I would create a hash of hashes. The name of the file I would use it as key then the secondary keys would be keywords like stat and path or location. Sample of hash of hashes (not tested):

my %HoH = ( file_name => { stat => 'date here', location => 'path to file' );

By iterating through the directories with your files you can check one by one the file and in case of common name you can compare the latest date and either update the hash or move ot the next one.

There are many modules that can help you find the file by searching the directories recursively for example File::Find

I would approach the problem like this.

Hope this helps. In case that something is not clear let me know and I will try to analyse my answer further.

BR, Thanos

Seeking for Perl wisdom...on the process of learning...not there...yet!

In reply to Re: GLOB function by thanos1983
in thread GLOB function by rahu_6697

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.