Hi and thanks for your time and effort, I really appreciate it. Your answer seems to do what I need in this case and is straightforward - very good for a newbie. I should actually delete the bit where I use the subroutine to create 5 step files, as it's confusing - it doesn't serve any purpose in my script, it's just my attempt to use "touch" and not forget how I did it. I will try your code now and thanks again so much :)

I had tried implementing a file counter but I can see now what I was doing wrong, I didn't think about using elsif and I got lost in continuous elses and ifs and failed to do it properly.

Regarding your comment about the ugly bit in my code, I completely agree. The problem is that I'm a coding newbie and the project I'm working on needs enormous scripts that I try to write myself, although I've never studied anything related to computers. I'm extremely pressured for time (and I won't mention my stress levels, lol) and although I did prefer your solution, it would mean that I would have to go and read on what glob does and I simply don't have the time to do it, and in this case it's ok since my ugly solution worked. However I had already printed and included your recommendation in my perl folder, where I keep corrections and solutions for future use, maybe for a future project. My supervisors just wouldn't be happy if I went back to make stuff prettier - as long as they work it's ok and I have to move forward, as I have deadlines to keep all the time :(

Again thank you very much for your time and answer, it looks really helpful.


In reply to Re^2: check for latest file, remove and touch file? by fasoli
in thread check for latest file, remove and touch file? 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.