I've read S5, and hopefully I've understood the new $<digit>-mechanism, that BTW seems very good to me. Only I have a suggestion that I hope not to be too awkward.

Why isn't matched text aliesed to $_ (topicalized) too? After all taking for example, and simplicity, a substitution (but the same would hold in a simple match) what one is doing is:

  s/ ... / ... /
     ^^^   ^^^
     ^^^   ^^^
     (1)   (2)

(1) Match this, then
(2) do something with *it*.

The basic idea is that even if this would be seldom useful, and even in those cases it would save only a few charachters, it is IMHO much less
probable that one would like to use "outer" $_ in a closure than the matched text.


(Hopefully Perl6-ish) examples:

  s/\b\d+/ { .num.hex() } /;
          #  ^^^^^^^^^^ Provided such a beast exists!

  s/ <complexstruct> / { m:w | <identifier> | } /;

Yes, I know, that for any example I may think of (including better ones than these) one may come up with other ways to do it, but I nevertheless think that from the huffmanization point of view my proposal could be interesting...


PS: this is something that I'd like in the substitution part of a s///e operator in Perl5 too: do you know actual code in which $_ was really used there?



Michele -- $\=q.,.,$_=q.print' ,\g,,( w,a'c'e'h,,map{$_-=qif/g/;chr }107..q[..117,q)[map+hex,split//,join' ,2B,, w$ECDF078D3' F9'5F3014$,$,];];$\.=$/,s,q,32,g,s,g,112,g,y,' , q,,eval;

Reply via email to