According to [EMAIL PROTECTED]:
> So how many stores do we expect for
>    ($a = "xxx") =~ s/a/b/g
> and which of the possible answers would be more useful?

I think it depends on C<($a = "aaa") =~ s/a/b/g>.

 * If the s/// operator stores once after all substitutions,
   then having it alway store whether the subst happened
   or not makes sense.  "One = one STORE; one =~ one STORE."

 * If the s/// operator stores once for each match/subst,
   then if no matches happen then no STOREs happen.

Minimal stores are also relevant for this oddity:

   ($a = "aaa") =~ s{a}
                    { $x++ ? substr($a,0,1) : 'b' }e;

Now, should that produce "bbb" or "baa"?  I favor "baa", because I
think minimal stores are too important to compromise them just for
this bizarre use case.
-- 
Chip Salzenberg         - a.k.a. -        <[EMAIL PROTECTED]>
  "Persistence in one opinion has never been considered
  a merit in political leaders." --Marcus Tullius Cicero

Reply via email to