for (@filenames) { s/CSS(\.[^\.]+\.ErrorLog)$/$1/; # remove CSS from end of antepenultimate token }