"be consistent" | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
The following code is a snippet from a script I'm writing.
When you present us with just a snippet (which we are not able to test ourselves), you run the risk of leaving out relevant details, and it would be more effective to show us a fully self-contained and runnable script (with suitable sample data) to demonstrate the problem. (Usually, in the process of trying to distill the problem into a stand-alone demonstration, you will figure out what the problem is and how to fix it on your own. It generally improves your ability to diagnose problems.) In the present case, we don't know if maybe you set $/ to undef, and maybe the input file is really big -- in which case, it's probably not the regex that's stalling, but the attempt to read the entire file into a single scalar variable. Apart from that (or something like that), I don't see anything to indicate a problem with the code as posted, except that there are "cosmetic" issues that could be improved (and cosmetic improvements can be worthwhile) -- e.g.: As for trying to debug the process, try running it with 'perl -d' (that is, use the perl debugger), so you can step through it and see where it really gets stuck, and even inspect variables to see whether other parts of the script are doing what you intended. (Oh, by the way, are you sure that everything following one or the other "header" string should be included in the corresponding container?) In reply to Re: Infinite regex loop...
by graff
|
|