in reply to How can I avoid code repetition here
What you can do is to make the regex in the substitution as simple as possible, by constructing it first:
my $subst_re = qr{^($lchompstr)*}; ... s/$subst_re//;
If you later on decide that you want to use non-capturing groups for the regex, you just have to change it one place.
|
|---|