$str =~ s/(?:\Q$chompstr\E)+\z//;
Or use the quotemeta builtin.
By the way you'd have to use chomp and not chop, because the latter unconditionally chops off the last character, whereas chomp removes $/.
In reply to Re: Chomping Frenzy question
by moritz
in thread Chomping Frenzy question
by rovf
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |