in reply to Re: /g matches not really global in scalar context!
in thread /g matches not really global in scalar context!

This behaviour is intended and documented. Consider the following:

[SNIP]

In other words, /g in a scalar context allows multiple distinct regexes to match after each other but from the place where the previous left off. This is very useful behaviour and is well worth familiarizing yourself with.
Indeed I was about to reply that if it is documented, then it is in some well hidden place, but checking perldoc perlop to be sure I found that it is very well documented!! So I wonder how I could fail to notice it for such a long time, but now that I know, even if it seems I've not really needed it till now, I fully agree that while slightly counter-intuitive, it's such a useful feature that that tiny ()= is a cheap trade-off...