BlaisePascal has asked for the wisdom of the Perl Monks concerning the following question:

Like knight, I am also interpolating values from an internal hash. I am dealing with several types of interpolation, using as syntax [FOO] (for simple interpolation) [FOO[x;y]] for a table-based lookup (row x, column y of table FOO), and [FOO(args...)] for user-defined functions. My code looks like
foreach ($string) { while (1) { s/\[(\w+)\]/&mlookup($1)/e and next; s/\[(\w+)\[(\d+);(\d+)\]\]/&tlookup($1,$2,$3)/e and next; s/\[(\w+)\((\w+(,\w+)*)\)\]/&flookup($1,$2)/e and next; last; } }
On -some- input, I'm getting a "Use of uninitialized value in substitution iterator" error, although it appears to do the substitution correctly. What does it mean, and how can I get rid of that warning?

Replies are listed 'Best First'.
Re: What is a
by tye (Sage) on Jul 28, 2000 at 02:33 UTC

    One of your function calls is returning undef. I can't think of much more to say.

Re: What is a
by BlaisePascal (Monk) on Jul 28, 2000 at 21:39 UTC
    Thanks tye, that helped... I was using split /:/,$foo instead of split /:/,$foo,-1, so some things weren't getting initialised properly.