It seems that traversing tree structures has proven to be harder that it looks :)

Is there any reason not to use File::Find? Code reuse has been proven to be fruitful.

As for your code, in the way it is presented, it is very hard to say anything concrete. You do not show the context of your function call (i.e. what the actual call looks like, what are the arguments...). The function itself uses global variables and there is no way to say how those are populated. Please look at How (Not) To Ask A Question for more comments on how to post your questions here. However, if I were to guess about the root cause of your problem, I would take a look at your @inputdir global array to see if it contains duplicate entries. Again, this is a shot in the dark!

BR

In reply to Re: READDIR: files printed twice in the directory ? by caelifer
in thread READDIR: files printed twice in the directory ? by bh_perl

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.