I am curious as to why you want to move the desired files? What purpose does that serve? Perhaps that is because there are a lot of "junk files"? I don't know.

A simple database of these relevant file names could be just what you need? I would need to know more about what the usage is.

A serious thing to consider is what happens when some file name is deleted as *text and how that affects your directory structure? Your program should have the property that it produces a valid result again and again even if some "line" is missing from the next run...

As an extra note...there is no need at all to use these $1, $2,$3 variables in almost all cases in Perl. There are of course exceptions...

my ($seq,$nr,...) =( /prefix_(\d+)_(\d+)_(\w+)(_)(\w+)(_)(\w+)(\.)(\w+)/)[1,2,3...];
This is called "array slice" and is powerful.

I figure that your regex is flawed. Do not use () to capture any thing that is not needed. These $1,$2,$3 variables are expensive. This \w+ then followed by "_" can also be "expensive". The underscore is part of the \w character set, a-zA-Z0-9_-.


In reply to Re: mkdir in loop - overwrite danger? by Marshall
in thread mkdir in loop - overwrite danger? by fasoli

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.