Have you ever heard of running perl in "debug" mode? It's really cool, and if you haven't tried it, you're missing a lot. Check out "perldoc perldebug", then run your script with perl -d name_of_script [command line args for @ARGV]
While the debugger is running your script, you can type "h" to get a brief summary of debugging commands; use "b findtext" to set a breakpoint in the sub, so whenever the execution enters that function, it stops to let you decide what to do next. At that point, you can step through a line at a time, set additional breakpoints, inspect current values of variables, and so on.
Since you have not posted the surrounding code that is calling the findtext sub, you're on your own. (I did say the code was not tested...) Post another reply if/when you get some firm, clear evidence about a specific problem, after trying a couple diagnoses and solutions on your own, in case you still can't figure it out at that point. | [reply] [d/l] |