If you have (or can get and use) a windows port of the unix "find", it might be interesting to see what happens when you run that tool on the Mac directories (save its output to a file), and then compare that to the output you'd get by just doing the equivalent thing in perl:
... my @dircontents = $dir->read(); print join "\n", @dircontents, ''; ...
I'm wondering what version of Perl you're using, and whether it might be having a problem with file names containing characters with byte values greater than 127. The "0x3F" character is a just question mark, no matter where you are, and I could imagine some ill-conceived "DWIM-ery" going on that might be based on not expecting characters above 127 in file names, or putting a "?" in place of such characters because there's nothing specified in your code about how to interpret them as characters (e.g. what to map them to in utf8). I'm not well acquainted with these issues on a Windows box, but I have seen, eg, MacArabic characters used in file names (from an Arabic newspaper cd-rom). Scary stuff. If your Perl release has a "perlunicode" man page, you might want to read that...

In reply to Re: Illegal characters in windows filenames? by graff
in thread Illegal characters in windows filenames? by HamNRye

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.