perl -e "\$_='qwerty'; s/r/print pos(). \"\n\";\$&/e; print \$_;" 3 qwerty