http://www.perlmonks.org?node_id=11110568

lzipin has asked for the wisdom of the Perl Monks concerning the following question:

O monks, I've found anomalous behavior with the Perl debugger, and I'd like a sanity check.

Here's a simple script that demonstrates the issue — at least on my laptop with a recent Xubuntu, Perl 5.26.1 and perl5db.pl v 1.51 (my Win7 machine with Strawberry Perl 5.28.2 doesn't have this problem). The script does a global regex replace on its first arg (word).

#!/bin/perl -w use strict; $_ = shift // ''; # line 3 s{a([bc])} # 4 {d$1}g; # 5 print; # 6

Open this in the debugger, l(ist) the script, and the 'print;' line is tagged line 5, not 6. The debugger doesn't find the script's line 5 ... although the script runs fine (e.g., the single arg 'abacadbd' yields 'dbdcadbd'). The debugger applies the commands 'c 5' and 'b 5' to the 'print;' line.

With one or more multiline replace statements in the middle of a sizable script, this gets aggravating. Further, it's a tough problem to Google — a possible bug in the debugger, etc.

Any resonance from No-Mind?