use Devel::Peek; $str = 'a string'; print 'x' x 50, "\n"; Dump($str); $str =~ m/(?:.(?{Dump($_);Dump(pos());pos()+=3; Dump($_);Dump(pos())}))/g; print STDERR "OUT\n"; Dump($str); #### __SIG__ use B; printf "You are here %08x\n", unpack "L!", unpack "P4", pack "L!", B::svref_2object(sub{})->OUTSIDE;