find . -name '*.wm[va]' -a -type f -exec mv '{}' '{}.txt' \;
Well, there are two main problems with this. First, he finds, not perl. Secondly, it’s actually just putting .txt at the end, not quite what you wanted.
The first problem is only a problem if you really have to do this in perl. This probably means you are just learning perl, but that’s fine, because this is just the first step. The second problem is only a problem if you just want to get the job done and don’t care about the language. First, I will solve the second problem:
find . -name '*.wm[va]' -a -type f | while read f; do mv $f ${f%.*}; done
It just does its job, but actually distracts us from the perl solution. This is because if you do everything in the search, you can convert to perl with find2perl:
find . -name '*.wm[va]' -a -type f -exec mv '{}' '{}.txt' \;
The perl script file opens, which you can save:
find2perl . -name '*.wm[va]' -a -type f -exec mv '{}' '{}.txt' \; > my.pl
It includes a doexec () function, which can be modified to do what you want. At first it would be to change the second argument to the correct name (using File :: Basename basename function: basename ($ command [2], qw / .wmv.wma /)), the second would simply eliminate system calls, STDOUT munging, etc. , and just call the rename. But that, at least, gives you a start.