In sticking with the core modules so that you don't have to install any new modules, here's some untested code that is basically a modified version of what Tux provided that handles your new requirement.

use File::Find; use File::Basename; use feature 'say'; my @files; find (sub { m/\.csv$/i && -s $_ < 5500 and push @files, $File::Find::N +ame }, "C:/Temp"); my %dirs; foreach my $file (@files) { my($filename, $directories, $suffix) = fileparse($file); $dirs{$directories}++; } my @keys = keys %dirs; @keys = sort @keys; foreach my $key (@keys) {say $key;}

Basically, what I've done is taken the array of files that meet your criteria and then putting their path (minus filename) into a hash where the path is a key in the hash (and the value for the key is the count of files in that folder that meet your criteria). Then I'm sorting the keys and printing them out. Hopefully, this will help get your further into solving your problem.


In reply to Re^3: Looking for small csv files script question by dasgar
in thread Looking for small csv files script question by PerlPlay

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.