in reply to Grep reutrn the occurance of a pattern

See @- and @+
while (/.../g) { print("Matched ", substr($var, $-[0], $+[0] - $-[0]), " at pos $-[0 +]\n"); }