|Just another Perl shrine|
Re: Problem with substrby marto (Bishop)
|on May 14, 2013 at 16:00 UTC||Need Help??|
"e.coli.replaced becomes e.coli (which is fine)
It doesn't. With your code it becomes "e.coli.".
"but z.mays becomes z.may (which isn't)."
Don't assume what rindex returns, try this for your test case:
A simpler way of doing this would be:
Should you actually wish the outcome to be as you specified and not what your code actually does.
Update: Fixed typo
Update 2: Dang, this is a must read, catches my mistake.