in reply to Re^2: extraction of text between 2 similar patterns in a text file
in thread extraction of text between 2 similar patterns in a text file

seek_m:

Since you don't use indentation, it makes your code difficult to read. So the first thing I'd suggest is reformatting it so you can more easily see the structure. I'd next suggest using "use strict;" and "use warnings;" to help find possible problems (such as closing file handles you don't actually have open).

Then I'd look at the bits you don't understand, and figure out what they mean. For example, what do you want the if statement on line 29 (if(/(\d\_)+a1/.../(\d\_)+a1/)) to do?. Since it governs when you actually emit files, it would be a good place to start.

Finally, you may want to read about the perl debugger, as executing code under the debugger can be very helpful to both fixing your program as well as understanding how the code operates.

...roboticus

When your only tool is a hammer, all problems look like your thumb.

Replies are listed 'Best First'.
Re^4: extraction of text between 2 similar patterns in a text file
by Anonymous Monk on May 17, 2011 at 15:37 UTC
    can you suggest me a good perl debugger?

      There's a debugger already built into perl 5.x. Just add the "-d" parameter to run your program under the debugger. It'll take a little getting used to, especially if you're used to pointy clicky windows. But it does the job nicely.

      It's documented in perldoc perldebug.

      ...roboticus

      When your only tool is a hammer, all problems look like your thumb.