Better:while (s/this/that/g) { push @matches, $&; }
while (s/this/that/gp) { push @matches, ${^MATCH}; }
Update: Thought it was m//g.
In reply to Re: Loop through global substitution
by ikegami
in thread Loop through global substitution
by alafarm
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |