Using diagnostics reveals this info:
Insecure dependency in rename while running with -T switch at (F) You tried to do something that the tainting mechanism didn't l +ike. The tainting mechanism is turned on when you're running setuid or setgid, or when you specify -T to turn it on explicitly. The tainting mechanism labels all data that's derived directly or indi +rectly from the user, who is considered to be unworthy of your trust. If + any such data is used in a "dangerous" operation, you get this error. + See perlsec for more information. Uncaught exception from user code: Insecure dependency in rename while running with -T switch at
Since you are not explicitly using -T, look into setuid or setgid.

By the way, changing readdir to glob will not solve the double-digit filename issue.


In reply to Re^3: Problem with renaming files in directory by toolic
in thread Problem with renaming files in directory by ice_ice_ice

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.