I added modifier /c also in the match. Please check the below code. But, still the pos() for regexp is not reset.
which is the expected behaviour, since (perlop again):
Options are:
c Do not reset search position on a failed match when /g is in effect.
g Match globally, i.e., find all occurrences.
The pos() is retained in all cases until the next match is attempted, so you have to remove the /g modifier on the second match, as casiano correctly noted, which will reset pos() just before the regep engine tries to match the second time.
--shmem
_($_=" "x(1<<5)."?\n".q·/)Oo. G°\ /
/\_¯/(q /
---------------------------- \__(m.====·.(_("always off the crowd"))."·
");sub _{s./.($e="'Itrs `mnsgdq Gdbj O`qkdq")=~y/"-y/#-z/;$e.e && print}