$file = "TBGL_SetMaterialDiffuse.htm"; open(FILE, $file) || die $!; $txt = do { local $/; }; close FILE; $txt =~ s/tbgl_(\pL+)/${1}_gl/g; open FILE, ">output.htm" or die $!; print FILE $txt; close FILE;