in reply to Looping on a match, and value of $1

I think the cause of the confusion is :
You are expecting the RegEx to be evaluated multiple times.

With the "g" modifier in a list context (which the "for" provides), the regex is evaluated only ONCE, returning a list of matches, which get successively aliased to "$_".

Since it is evaluated only once, the last match (value 5) is stored in $1.

Update Oops - Beaten to the punch in explaining.

However, try the Regex in a SCALAR context, and it will behave as you expect (diotalevi's suggestion):

# Note: Changed "for" to "while" for scalar context: $a='1b2cde5';while($a=~/(\d+)/g){$t+=$1;}; print qq($t\n) --Output-- 8

    Earth first! (We'll rob the other planets later)