in reply to Re: Chomping Frenzy question
in thread Chomping Frenzy question
$str =~ s/(?:\Q$chompstr\E)+\z//;
Wouldn't this also fail if $chompstr contained \E ?
Or use the quotemeta builtin.
This is nice! I had used this function a few years ago, but meanwhile forgotten it.
By the way you'd have to use chomp and not chop
Of course, you are right. I was too careless when sketching my solutions...
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Chomping Frenzy question
by moritz (Cardinal) on Jul 10, 2008 at 14:24 UTC | |
|
Re^3: Chomping Frenzy question
by ikegami (Patriarch) on Jul 10, 2008 at 18:40 UTC |