[EMAIL PROTECTED] skribis 2006-10-09 0:22 (-0700): > P5's s[pat][repl] syntax is dead, now use s[pat] = "repl"
Why keep the s? substr works perfectly as both rvalue and lvalue, and I think m[], also known as //, can do the same. No need to do things based on delimiter (bracket versus non-bracket), then. > + s[pattern] = doit() m[pattern] = doit(); /pattern/ = doit(); > + $str.subst(/pat/, "replacement"); > + $str.subst(/pat/, {"replacement"}); > + $str.=subst(/pat/, "replacement"); > + $str.=subst(/pat/, {"replacement"}); Hmmm... I have no answer for the non-mutating version, but: $str.match(/pat/) = "replacement"; $str.m(/pat) = "replacement"; > +This is not a normal assigment, since the right side is evaluated each > +time the substitution matches Can't this be generalized somehow? Return an lvalue proxy, like substr does, and make thunking the default for certain LHS types. I don't like special syntax that looks like normal syntax. -- korajn salutojn, juerd waalboer: perl hacker <[EMAIL PROTECTED]> <http://juerd.nl/sig> convolution: ict solutions and consultancy <[EMAIL PROTECTED]> Ik vertrouw stemcomputers niet. Zie <http://www.wijvertrouwenstemcomputersniet.nl/>.