E
ebm
I'm looking for a quick way to do a search and replace on an array of
values.
for instance I can do it this way, but is there a better way?
my @files = ("File1","File2");
my $path = ("c:\\path\\to\\");
@PathFile = map { [ $path . $_ ] } @files;
$newPath = "D:\\new\\place";
# now I have my path and file names combined and
#I can do some stuff with this. after I've done my work
# with it, is there an easy way to change my path name in
# my @newPath array?
# I can do it this way but is there a better way?
foreach(@newPath){
$_ =~ s/C:\\/D:\\/;
push ( @newArray, $_ );
}
# I want to do something like
# this @newPath =~ s/\Q$path\E/\Q$newPath\E/;
Can somebody give me a hand?
values.
for instance I can do it this way, but is there a better way?
my @files = ("File1","File2");
my $path = ("c:\\path\\to\\");
@PathFile = map { [ $path . $_ ] } @files;
$newPath = "D:\\new\\place";
# now I have my path and file names combined and
#I can do some stuff with this. after I've done my work
# with it, is there an easy way to change my path name in
# my @newPath array?
# I can do it this way but is there a better way?
foreach(@newPath){
$_ =~ s/C:\\/D:\\/;
push ( @newArray, $_ );
}
# I want to do something like
# this @newPath =~ s/\Q$path\E/\Q$newPath\E/;
Can somebody give me a hand?