You weren't too far off, i prefer to use a for loop instead and avoid explicitly using $1 whenever i can. Here's a little scheme i developed for myself a while back. Start with a simple for loop - grab the files you want and print them out:
perl -le'for(<*html>){print}'
Next grab a copy of $_, perform substitution on $_ and print
perl -le'for(<*html>){$o=$_;s/^new/U/;print}'
Finally, drop the print and do some damage
perl -e'for(<*html>){$o=$_;s/^new/U/;rename $o,$_}'
The first step is just to set up a working one-liner. The second step is important, as you will see what the results will look like, but i still like to live dangerously and just hammer out the third step unless i am using data of any importance. Be safe. :)

jeffa

L-LL-L--L-LL-L--L-LL-L--
-R--R-RR-R--R-RR-R--R-RR
B--B--B--B--B--B--B--B--
H---H---H---H---H---H---
(the triplet paradiddle with high-hat)

In reply to Re: batch rename with a 1 liner by jeffa
in thread batch rename with a 1 liner by Theo

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.