Hi Monks I'm having some issues with trying to get a substitution working or to think of another method to do what I need done. I have the following code
find(\&all, @allpaths); open (LIST, ">$filepath/Paths.bak") or die "$! error trying to ove +rwrite"; foreach my $p (@allpathlisting) { print LIST "$p\n"; } close LIST; copy $allpatholdfile, $allpathnewfile or die "$! error trying to c +opyfile"; sub all { return unless -d; $File::Find::prune = 1 if /[IPDLMY]\d{8}$/; (my $fn = $File::Find::name) =~ tr#/#\\#; push @allpathlisting, $fn if /[IPDLMY]\d{8}$/; print "$fn\n" if /[IPDLMY]\d{8}$/; foreach (@allpathlisting) { s/gpfs_data/nas\/rdds/; } }
I want to replace /gpfs_data/ with /nas/rdds/ I'm wondering if the code below
foreach (@allpathlisting) { s/gpfs_data/nas\/rdds/; }
Could be added somehow to
(my $fn = $File::Find::name) =~ tr#/#\\#;
Because my script is taking a bit longer to run now and I can't get Perl to replace the / with \ in this bit /nas\/rdds/
Sorry for the formatting, I had comments at the ends of lines but pasting it here made the code all weird
In reply to Substitution query by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |