in reply to Is it possible to use repetition within a Regular Expression Substitution?
my $stars = "*" x 80; s/^-{40}\cM*$/$stars/; [download]
my $stars = "*" x 80; my $dashes = "-" x 40; s/^$dashes\cM*$/$stars/; [download]