Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re^3: How to Rename files in multiple directories with a Perl script using an array of hashes.

by hv (Prior)
on Jun 11, 2023 at 19:13 UTC ( [id://11152786]=note: print w/replies, xml ) Need Help??


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 },
  • Comment on Re^3: How to Rename files in multiple directories with a Perl script using an array of hashes.
  • Select or Download Code

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

    Thank you.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11152786]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (5)
As of 2024-04-21 18:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found