you can use glob to collect all files you need. Then foreach file you are processing you can make up the name of the copy changing it's extension from .txt to .csv
Please note that Perl has many options to do such kind of operations with a single line of program: see perlrun and serch for -i -l -n switches. See Inplace Editing for a bunch of examples.
L*
|
|---|