I also wanted to abuse the regex system with twelve-level-deep s///e
recursion to implement my Pentominos Solving Quine
, but instead found that perl would crash horribly if it tried to recurse there.
for $pattern (@patterns)
while ($data =~ m/(?=$pattern)/g)
do_recurse($data, pos($data), $pattern);
# $data is the source
# pos($data) is the found place in the souce
The alternative method uses pos()
as an lvalue and m/(?=)/g
as in the loop above, to allow me to iterate through matches yet not recurse via any regex code-evaluating trick. I do recurse, but not by getting the regex to do the call.
[ e d @ h a l l e y . c c ]