in reply to Re^2: How to Rename files in multiple directories with a Perl script using an array of hashes.
in thread How to Rename files in multiple directories with a Perl script using an array of hashes.
Now that I have corrected the glob path array, only the FIRST _ character is being replaced, rather than every instance in the filename.
Ah, that'll be because that's what you've asked for: to replace them all, you need to add the //g flag ("global") to the substitution:
_code => sub { s/_/ /g },
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: How to Rename files in multiple directories with a Perl script using an array of hashes.
by ObiPanda (Acolyte) on Jun 11, 2023 at 20:54 UTC |