Thanks for help, you have understood the problem quite well, I have to sort files with same basename present in different directory and subdirectories according to their mtime such that only latest modified file would come in @filelist. Later I have to work on these files separately to fetch some particular data which is working fine for me.I have done changes as per your code but on terminal these errors are coming. Please resolve this issue as I am working on a shared workspace so I can't install any package in linux.

Use of uninitialized value $arg in stat at /user/s5e7420/local/lib/per +l5/5.18.0/File/stat.pm line 206. Use of uninitialized value $name in index at /user/s5e7420/local/lib/p +erl5/5.18.0/Symbol.pm line 118. Use of uninitialized value $name in pattern match (m//) at /user/s5e74 +20/local/lib/perl5/5.18.0/Symbol.pm line 121. Use of uninitialized value $name in hash element at /user/s5e7420/loca +l/lib/perl5/5.18.0/Symbol.pm line 121. Use of uninitialized value $name in concatenation (.) or string at /us +er/s5e7420/local/lib/perl5/5.18.0/Symbol.pm line 129. Can't call method "mtime" on an undefined value at script.pl line 13.

In reply to Re^2: GLOB function by rahu_6697
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.