I don't understand what your code is trying to do, neither from your code nor from your description. Can you please look at the following list and expand it so we have a common understanding of what the code is supposed to do?
- Read file FILE_LAST_MOD_DIR to get a list of directories to look in
- While we have directories in that list do:
- For each directory, look if there is a file with the name matching *END*.txt
- If such a file exists, remove that file from the FILE_LAST_MOD_DIR and our list.
If the above description is correct, then consider using Tie::File to treat a line-oriented file just like an array. For removing files, see unlink, not delete. You will also likely want to use the File::Glob::bsd_glob function instead of the find program.
For your coding style, please don't use C-style for loops. They are almost always an error. It's better to use the foreach-style of loops.
You haven't told us what the output of your program is and where it enters into an infinite loop. If you would provide a self-contained example that does not rely on a specific directory structure and specific files, that would help us replicate your problem and then we could help you better with your concrete problem.
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.