I did not really understand what your problem is, and it is a bit late for me now, so I have to give up trying to get the point. Just one point that I noticed, though, and may possibly explain unexpected behavior: the $stuff variable is not the same in the two programs:
my $stuff = "On the outside now then (we go( in( and in (&stop)(awhile
+) ( further ))) but still (here) ) and now (for a while) we are out a
my $stuff = "On the outside now then (we go( in( and in(&stop)(awhile)
+ ( further ))) but still (here) ) and now (for a while) we are out ag
Or to show it more clearly (I hate the way the Perlmonks site dispays code snippet, why should it cut it at line 70 or 71, making any significant code almost unreadable, at a time where most people don't have any problem displaying 250 or 300 characters on their screen?), I"ll just quote where the difference is:
A space missing. Small difference. No idea if this is the source of your problem, but I thought it might be useful to let you know.