in reply to Substr warning

The first message means that your variable $ch actually is empty at that time in the loop.
The second means the same.
"substr outside of string"   means you are trying to get at characters where there is no string left to get them from.
Imagine you're trying to get the second character of a string that's only one character long.

Cheerio, Sören

Replies are listed 'Best First'.
Re^2: Substr warning
by Anonymous Monk on Sep 24, 2004 at 14:16 UTC
    Hi,

    thanks for this. There is plenty of string left, maybe there es a problem with special characters. The problems occurs at least one time while trying to read in a French name (with accent grave).

    Is there a way to tell perl to ignore these special characters for the moment, so that I can transform them later?

    Cheers!

      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.