<?xml version="1.0" encoding="windows-1252"?>
<node id="376737" title="No Pause on Elsif in Debugger" created="2004-07-22 17:55:30" updated="2005-08-13 22:16:18">
<type id="115">
perlquestion</type>
<author id="294463">
QM</author>
<data>
<field name="doctext">
I've noticed recently that the debugger doesn't pause on &lt;code&gt;elsif&lt;/code&gt;s, making it confusing to follow sometimes. 
&lt;p&gt;
For instance, given this code:
&lt;blockquote&gt;&lt;code&gt;
#!/your/perl/here

use strict;
use warnings;

my $rand = rand;

if ( $rand &lt; rand ) # 1
{
	print "if 1: $rand\n";
}
elsif ( $rand &lt; rand ) # 2
{
	print "elsif 2: $rand\n";
}
elsif ( $rand &lt; rand ) # 3
{
	print "elsif 3: $rand\n";
}
else
{
	print "else 4: $rand\n";
}
&lt;/code&gt;&lt;/blockquote&gt;
I get the following in a debugger session:
&lt;blockquote&gt;&lt;code&gt;
C:\Perl\perl\perlmonks&gt;perl -d skip_elsif.pl

Loading DB routines from perl5db.pl version 1.19
Editor support available.

Enter h or `h h' for help, or `perldoc perldebug' for more help.

main::(skip_elsif.pl:6):        my $rand = rand;
  DB&lt;1&gt; s
main::(skip_elsif.pl:8):        if ( $rand &lt; rand ) # 1
main::(skip_elsif.pl:9):        {
  DB&lt;1&gt; p $rand
0.63232421875
  DB&lt;2&gt;
main::(skip_elsif.pl:22):               print "else 4: $rand\n";
  DB&lt;2&gt;
else 4: 0.63232421875
&lt;/code&gt;&lt;/blockquote&gt;
I'm expecting the debugger to pause on each conditional, especially as I might want to inspect some of the variables before the next evaluation. &amp;#091;I wouldn't mind if it paused on &lt;code&gt;else&lt;/code&gt;s also, but I supposed that's too much to ask?&amp;#093;
&lt;p&gt;
Why does it work this way?
&lt;div class="pmsig"&gt;&lt;div class="pmsig-294463"&gt;
&lt;p&gt;-QM&lt;br /&gt;
--&lt;br /&gt;
Quantum Mechanics: The dreams stuff is made of
&lt;/div&gt;&lt;/div&gt;</field>
</data>
</node>
