In a message dated Wed, 4 Sep 2002, Jonathan Scott Duff writes: > The thread on hypotheticals has caused me to reread that section of A5 a > few times now and a couple of paragraphs bother me the more I read > them. I'll just quote the parts that bother me: > > ... If a regex sets a hypothetical variable that was declared > with either my or our beforehand, then the regex modifies that > lexical or package variable, and let is purely a run-time > operation. > > On the other hand, if the variable is not pre-declared, it's > actually stored in the regex state object. In this case, the let > also serves to declare the variable as lexically scoped to the > rest of the regex, in addition to its run-time action. ... > > So, each time I use a hypothetical, I have to be concious of which > variables are currently in scope? Perl can't help be with this task > because how does it know if I meant to hypothetically clobber that > lexical or store something in the match object. This is only really a > problem if you expect "let" variables to always show up in the match > object and sometimes they don't. So why not make it so that "let" > also always causes these variables to appear in the match object?
It should. I think everyone has been proceeding under the assumption that they are. If you use a variable name already defined, then you set both the match object's attribute of the same name (minus the sigil if sigil is '$') *and* the external variable. Trey