Thinking about the brace matching problem, regarding the specific
problem of writing a regex to match any valid specification of
a scalar written like
${expression returning name or reference goes here}
I realized that no amount of lookahead is going to be without possible
problems.
So why not give up and try another direction? A special backslash
assertion that matches ___> a valid perl expression which appears as if
it would return a value <___ would be just the thing.
We could call it \v for valid, and it would match as far as it could get
in validity.
($Name_Of_The_First_Interpolable_Scalar) = m/\$(\w+|(\{\v\}))/;
It's opposite, \V, is something I'd like to know more about before submitting
a RFC on this idea. Would it be greedy? Would it require a quantifier, matching
dot for that many, and then validate the results? Maybe it should be left undefined:
can anyone come up with a situation in which you'd want to match all the characters
that were not syntactically valid, or match up to the last token that would match all
the previous brackets?
--
David Nicol 816.235.1187 [EMAIL PROTECTED]
perl -e'map{sleep print$w[rand@w]}@w=<>' ~/nsmail/Inbox