in reply to Re^2: Substr warning
in thread Substr warning

No, you're barking up the wrong tree. That warning can only mean that your starting index is bigger then the length of the string — or, if negative, too large on the other side. Perl starts counting from the end of the string backwards, then. Special characters have nothing at all to do with it.

As an aside: I think your approach is wrong. You're tackling this as if you're programming in C. Perl has better ways to parse strings than this extremely low level stuff: you really should take a step back, decide what you're actually trying to achieve, and use a regex or maybe two, to do the same job.