看你的需求只能需要用正则匹配出来 替换就行了。。
```
#!/usr/bin/perl6
sub MAIN(*@files) {
for @
files -> $_ is copy {
my $sn = $_;
s/^
(S\d+E\d+)
\.
([ <-[\.]>+ ]+ % \.)
\.
(.*)
$/$0 - {$_ = $1; tr/\./ /; $_}.$2/;
my $status = rename($sn, $_);
say "rename \[$status\]: {$sn} => {$_}";
}
}
```
以下是效果,你的 The Big Bang Theory 我没加,不知道这是不是符合你的要求。。
$ ./rename.p6 *.ass *.mkv
rename [True]: S01E01.Pilot.ass => S01E01 - Pilot.ass
rename [True]: S01E02.The.Big.Bran.Hypothesis.ass => S01E02 - The Big Bran Hypothesis.ass
rename [True]: S01E03.The.Fuzzy.Boots.Corollary.ass => S01E03 - The Fuzzy Boots Corollary.ass
rename [True]: S01E04.The.Luminous.Fish.Effect.ass => S01E04 - The Luminous Fish Effect.ass
rename [True]: S01E05.The.Hamburger.Postulate.ass => S01E05 - The Hamburger Postulate.ass
rename [True]: S01E01.Pilot.mkv => S01E01 - Pilot.mkv
rename [True]: S01E02.The.Big.Bran.Hypothesis.mkv => S01E02 - The Big Bran Hypothesis.mkv
rename [True]: S01E03.The.Fuzzy.Boots.Corollary.mkv => S01E03 - The Fuzzy Boots Corollary.mkv
rename [True]: S01E04.The.Luminous.Fish.Effect.mkv => S01E04 - The Luminous Fish Effect.mkv
rename [True]: S01E05.The.Hamburger.Postulate.mkv => S01E05 - The Hamburger Postulate.mkv