in reply to Re^2: Chomping Frenzy question
in thread Chomping Frenzy question
$s =~ y/*+!//d;This would replace all the characters in $s, not only those in the end, and it would replace them in any sequence - so this is not useable in my situation.
No, it wouldn't (remove any character).
It removes any occurence of the characters '*', '+' and '!' (it's a use of the transliterate operator tr/// (same as y///). It doesn't care about the position of the characters.
$ perl -e 'my $s = "xyabcy*+!*+!*+!*+!*+!*+!"; $s =~ y/*+!//d; print +$s, $/;' xyabcy $ perl -e 'my $s = "*+!xyabcy*+!*+!*+!*+!*+!*+!"; $s =~ y/*+!//d; pri +nt $s, $/;' xyabcy $
I don't think, that tr/// or y/// can help you with your chomp problem.
update: minor changes in text (... remove any char...)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Chomping Frenzy question
by rovf (Priest) on Jul 11, 2008 at 08:57 UTC |