>Thinking about the comparision between the two RFCs there is some common
>ground, but cases where people will want your hash and cases where
>people will want explicit variables.  Using RFC 112, you can do
>hash assignment, but it would not clear the hash beforehand whereas
>your hash assignment would (I assume) set the hash to ONLY those elements
>from the regex.
>
>Your %hash = $string =~ /..(?%foo=..)/
>is essentially the same as my %hash = (); $string =~ /..(?$hash{foo}=..)/

I had assumed (incorrectly) the RFC 112 only allowed for assignment 
to simple scalars ($asdf), and not for more complicated expressions 
(e.g. $aa{asdf}).  I now see that RFC 112 provides much of the 
functionality of RFC 150.

For the applications I have in mind, I still have preference for RFC 
150.  I think of regular expressions functions which operate on 
strings, and it's more natural for functions to return values the 
normal way, rather than assigning to fixed variables.

>Do we need both?  I think the answer is prossibly, but whatever is
>decided about back refereces should apply to both.
>
>My thoughts on the back references would be, that if a variable is used
>again later in the regex, assignment takes place and it is simply refered
>to.
>
>Thus $string =~ m#<(?$foo=\w+).*?</$foo>#;
>
>The parse notices the reuse of $foo and performs the actual assigment
>as and when the foo is matched (or at least acts as if it does).

This seems like the right way to do it for RFC 112.  There are, of 
course, scoping issues, as someone else pointed out.

Reply via email to