I'm not saying the other suggestions are wrong, but those suggestions are using some syntax that I personally don't understand - at least not without looking up documentation and/or doing some testing. That's why I would prefer going with something that I find easier to read and understand. Just a personal preference.

I haven't tested this, but the code below is something that I believe should accomplish what you're wanting to do and is something that I personally find much easier to read and understand.

use strict; use warnings; use File::Find::Rule; my $target = 'C:\temp'; my $rule = File::Find::Rule->new; $rule->file; # Look for files (-f test) $rule->name('*.csv'); # Look for filenames ending in .csv $rule->size(<5500); # Look for a size of less than 5500 bytes my @files = $rule->in($target); # The @files array will have the files that meet the 'rules' above.

I realize that this doesn't go well with your comment that you "can't install other File:Find module alternatives". Out of curiosity, why are you limited by not installing any modules?


In reply to Re: 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.