for (@filenames) {
s/CSS//;
}
# or written with a statement modifier:
# s/CSS// for @filenames;
####
for (@filenames) {
s{ # substitute
CSS # the string CSS
( # and a capture consisting in
\. # a literal dot,
[^\.]+ # any number of non-dots,
\. # another literal dot,
ErrorLog # and the constant ErrorLog
) # (end of capture)
$ # anchored at the end of the string
}
{$1}x; # against the capture above
}
####
for (@filenames) {
s/CSS(\.[^\.]+\.ErrorLog)$/$1/; # remove CSS from end of antepenultimate token
}
####
for (@filenames) {
if (/CSS/) {
my @t = split /\./;
$t[-3] =~ s/CSS$//;
$_ = join '.', @t;
}
}