I have noticed errors in what perl reports for line numbers, and I'm wondering if some light can be shed here. In one script I'm working with:
prints 4 for the line number when even I can see that it should print 5. This same script reports 162 for the final line number, when it is actually 181. That's a pretty big error! Moreover, if I add a line to the top of the file:package Args; use v5.10; use strict; use warnings; print __LINE__, "\n";
it prints 1 and 4 .. the original 4 hasn't changed, and the original 162 at the bottom is still 162. If I add a blank line at the top, though, the subsequent line numbers increment properly (though they're still wrong).print __LINE__, "\n"; package Args; use v5.10; use strict; use warnings; print __LINE__, "\n";
To compound the weirdness, I can copy the lines above and paste them into a new file, which is otherwise empty, and the line numbers are correctly reported, though I suspect errors will creep in if I continue working in that new file. I have noticed similar shenanigans in other scripts I'm working with: The line numbering just gets worse as I go along.
Curiously, a web search doesn't find anyone complaining about this, so I thought I'd come here and ask. I'm using v5.14, the dwimperl release, by the way. Maybe I should update to a later release. Anyway, any wisdom you can offer will be greatly appreciated. Thanks.
In reply to Bad line numbers .. bad! by phramus
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |