http://www.perlmonks.org?node_id=771891


in reply to Re^2: string error message
in thread string error message

That regex won't produce undef for one of the captures only some of the time - the match is failing, so all the variables are presumably undef.

Replies are listed 'Best First'.
Re^4: string error message
by Marshall (Canon) on Jun 16, 2009 at 06:20 UTC
    Not necessarily. That may not happen in the general case. This gets complex. In this particular regex, I think you are right, the first undef results in subsequent undef's. In any event the code I showed will show what happens. As a response I tried to show a method to debug this. The "here is how to grow wheat" instead of "here is some wheat" idea. I'm hoping that it helped.