in reply to How can I avoid code repetition here

I wouldn't worry too much about code duplication here. It's just one statement which is repeated twice. If you abstract it away in another function, you repeat the function call twice - no real net gain.

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.

Perl 6 - links to (nearly) everything that is Perl 6.