in reply to Chomping Frenzy question
$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 $/.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Chomping Frenzy question
by rovf (Priest) on Jul 10, 2008 at 14:14 UTC | |
by moritz (Cardinal) on Jul 10, 2008 at 14:24 UTC | |
by ikegami (Patriarch) on Jul 10, 2008 at 18:40 UTC |