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,