if (@groups = /$test_regexp/g) { while (@groups) { ($url, $file) = splice @groups, 0, 2; # ... } } #### while (/$test_regexp/g) { ($url, $file) = ($1, $2); # ... }