a* means zero or more instances of: a right?
so why does $_ = "a"; s/a*/e/g produce: ee
Possible answer: it's replacing the string: "a" with: "e" and it's replacing the empty string: "" with: "e" as well. Or it's replacing the mere absence of a letter: a with a letter: e or it's replacing "zero occurrences" of: a with an: e
Ok then, but:
$_ = "b"; s/a*/e/g produces: ebe
It seems to be replacing the empty string to the left of: b and also the empty string to the right of: b
OK. But then why doesn't it do that for: "a" ? Why doesn't it replace the empty string to the left of: a and also the empty string to the right of: a and also the letter: a itself to get: eee ?
There are just as many zero occurrences of: a on the left side as the right side!