deshdaaz has asked for the wisdom of the Perl Monks concerning the following question:
Hello, I am reading a large file and trying to strip off some trailing characters from the words captured through matching and then print them. It seems only one of the substitution works correctly and others don't. Please look at the code below. The script is correctly removing the "_x_s" from the words but it does not remove other ones..
Kind of puzzling why one works and the others don't. Thanks for reading monks. Sorry if I am doing something egregiously wrong in my code.# Matched element is passed to $pat for further processing. $pat = $1; $pat =~ s/_x_x$//i; #This is not working. $pat =~ s/_x_s$//i; #This is working. $pat =~ s/_x$//i; #This is not working. print $pat;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: End of line anchor question
by toolic (Bishop) on Apr 23, 2012 at 18:50 UTC | |
|
Re: End of line anchor question
by deshdaaz (Novice) on Apr 23, 2012 at 18:53 UTC |