how to skip to a certain loop with debugging option perl -d

H

Hendrik Maryns

Hi,

i've been reading perldebut and it already helped me solving that
annoying warning that kept occurring, but not on the most efficient way:
I had to skip through 61 executions of a loop before reaching it!

So I was wondering: is there something like the c option that skips
through /N/ iterations of a loop, before stopping at the breakpoint
again (which is inside the loop, obviously). I didn't find anything
like that described in perldebug, so this time I thought I'd dare asking
(I started to read the guidelines indeed:p)

Cheers, H.
 
H

Hendrik Maryns

Bob Walton schreef:
Well, the "b" (break) debugger command has an optional third argument
which is a condition that must be true for the break to occur. So, for
example:

for(0..50){
print "$_\n";
}

can be broken on the iteration when $_ is 10 with:

b 2 $_==10
c

For example:

D:\junk>type junk513.pl
for(0..50){
print "$_\n";
}

D:\junk>perl -d junk513.pl

Loading DB routines from perl5db.pl version 1.25
Editor support available.

Enter h or `h h' for help, or `perldoc perldebug' for more help.

main::(junk513.pl:1): for(0..50){
DB<1> b 2 $_==10
DB<2> c
0
1
2
3
4
5
6
7
8
9
main::(junk513.pl:2): print "$_\n";
DB<2> x $_
0 10
DB<3> q

D:\junk>

Does that help?

Yes, perfect, thanks (it might seem a strange question, but it is
because the problem wasn't in the code, but in the input data. Of
course I slightly changed the code to catch that...)
H.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top