Paul 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?

No, you have to store the modified file name in a different variable.

I'm wanting to remove spaces only in the filenames with:
s/\ //g

My copy line reads:
copy( "$dir/$file", "$newdir/$file" );

( my $new = $file ) =~ tr/ //d;  # or =~ s/ //g if you prefer

copy( "$dir/$file", "$newdir/$new" );



John
--
Perl isn't a toolbox, but a small machine shop where you
can special-order certain sorts of tools at low cost and
in short order.                            -- Larry Wall

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to