Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: Perl Rename set of files

by choroba (Cardinal)
on Sep 26, 2016 at 14:08 UTC ( [id://1172637]=note: print w/replies, xml ) Need Help??


in reply to Perl Rename set of files

Use split to split the string into a list:
my @items = split / ,/, $code;

Then, iterate over the array and change the name:

for my $item (@items) { my @matching = glob "$dir/$item*.PRODUCTS.sold"; for my $file (@matching) { ( my $newname = $file ) =~ s/sold$/ordered/; rename $file, $newname; } }

($q=q:Sq=~/;[c](.)(.)/;chr(-||-|5+lengthSq)`"S|oS2"`map{chr |+ord }map{substrSq`S_+|`|}3E|-|`7**2-3:)=~y+S|`+$1,++print+eval$q,q,a,

Log In?
Username:
Password:

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

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

    No recent polls found