On Wed, July 18, 2007 3:58 pm, John W. Krahn wrote: > 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" );
Works like a champ! Thanks allot! -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/