http://qs321.pair.com?node_id=1068068


in reply to Re: multiple matches per line *AND* multiple capture groups per match
in thread multiple matches per line *AND* multiple capture groups per match

This. Your solution is fine, but you need to do a bit of postprocessing, e.g.
if (@groups = /$test_regexp/g) { while (@groups) { ($url, $file) = splice @groups, 0, 2; # ... } }
or use a loop:
while (/$test_regexp/g) { ($url, $file) = ($1, $2); # ... }