current statement, you may see it jump around oddly. As recently as version 5.004_04 of perl, this could be observed in a program like the following: 1 my @a = qw(one two three); 2 while ($_ = pop @a) 3 { 4 print “$_n”; 5 } 6 1; See what happens when we step through this, again using perl 5.004_04 or earlier: main::(while.pl:1): my @a = qw(one two three); DB<1> n main::(while.pl:6): 1; DB<1> main::(while.pl:4): print “$_n”; DB<1> three main::(while.pl:2): while ($_ = pop @a) DB<1> main::(while.pl:4): print “$_n”; DB<1> two In fact, if we set a breakpoint for line 6 and ran to it, we’d get there before the loop executed at all. So it’s important to realize that under some circumstances, what the debugger tells you about where you are can be confusing. If this inconveniences you, upgrade. 7.2.11 Another “Gotcha” If you set a lexical variable as the last statement of a block, there is no way to see what it was set to if the block exits to a scope that doesn’t include the lexical. Why would code do that? In a word, closures. For example, { # Start a closure-enclosing block my $spam_type; # This lexical will outlive its block sub type_spam { # … $spam_type = $spam_types[complex_func()]; } } In this case, either type_spam or some other subroutine in the closure block would have a good reason for seeing the last value of $spam_type. But if you’re stepping through in the debugger, you won’t see the value it gets set to on the last line because, after the statement executes, the debugger pops out to a scope where $spam_type is not in scope (unless
Note: If you are looking for cheap and quality provider to host and run your java application check Astra java hosting services