newbie1991 has asked for the wisdom of the Perl Monks concerning the following question:
Hi, I have a list of names that I am trying to clean up. Some of them have ".replaced" after the name, which I am trying to remove. The code I am using is this :
The line works just fine for the names that are followed by the "replaced", however, the last letter of the name gets cut off if the name is not followed by "replaced". e.coli.replaced becomes e.coli (which is fine), but z.mays becomes z.may (which isn't). How can I fix this?$name = substr $name, 0, rindex( $name, q{replaced} );
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Problem with substr
by marto (Cardinal) on May 14, 2013 at 16:00 UTC | |
by AnomalousMonk (Archbishop) on May 14, 2013 at 19:34 UTC | |
by newbie1991 (Acolyte) on May 14, 2013 at 16:19 UTC | |
|
Re: Problem with substr
by kennethk (Abbot) on May 14, 2013 at 16:03 UTC |