On Fri, 25 Oct 2002, I wrote: > > why not simply extend pattern-matching in a similar way to substr, making it > > an L-value, so that one gets > > > > $str ~ /[aeiou]+/ = "vowels($&)" > > > > or > > > > $str ~ /\d/ {hyper-symbol}= (0) x {size-of-LHS-array};
On Thu, 24 Oct 2002, Larry Wall replied: > Problem with that...the replacement argument has to be lazy, and currently > the RHS of an assignment is actually evaluated before the left. You'd > really need something more like > > $str =~ /\d/ = { 0 } How about just $str =~ /\d/ .= "0" or $str =~ /\d/ .= { 1 + $_ .& 7 } in which using "." (apply) would force a fetch of the LHS in advance of evaluating the RHS. And for global-replace we could use the vector/hyper notation: $str =~ /\d/ [.=] "0" > However, I think readability suffers without a hint on the front what > you're trying to do. We don't in general have a "let" on the front of assignment statements; why should this type of assignment be any different? (Do we want a "let" keyword? Personally I don't think so, but what do others think?) -Martin -- How to build a Caspian Sea oil pipeline - step one: get elected president...