On 7/18/07, Paul <[EMAIL PROTECTED]> wrote:
I have a line that is reading files from and array and copying to a
different directory. Is there a way to rename the file with regex at the
same time?
I'm wanting to remove spaces only in the filenames with:
s/\ //g
My copy line reads:
copy( "$dir/$file", "$newdir/$file" );
If I need to work with the "$file" variable before doing the copy is fine,
whatever works. I'm stumped as to how to do it. It's on a windows box.
Thanks.
I am not sure I understand you correctly, but I think this is what you
are talking about:
for my $file (@files) {
(my $newfile = $file) =~ s/ //g;
copy("$dir/$file", "$newdir/$newfile");
}
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/