Hello, I'm trying to find a file within a folder, but the file names aren't exact. The beginning contains a random number and the second contains a hash string separated by a period. I've produced the following code, but it takes far too long to execute for my planned use. If anyone has a faster method for doing this (including a linux command), I would love to hear how. Example file: 103746383.100740266a1b4bf5d456cb8876be0e4e9662d871
sub find_hash_core(){ opendir(DIR,"./"); @a = readdir(DIR); close(DIR); foreach (@a) { #print "$_"; if ($_ =~ "100740266a1b4bf5d456cb8876be0e4e9662d871"){ print "Found Hash!"; } } }

In reply to Quickly Find Files with Wildcard? by expresspotato

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.