$_ = "aaaaa"; while (/aa/g) { print "Match at $-[0]\n"; pos = $-[0] + 1; }