in reply to Loop through global substitution

while (s/this/that/g) { push @matches, $&; }
Better:
while (s/this/that/gp) { push @matches, ${^MATCH}; }

Update: Thought it was m//g.