I'm seeking a strategy for diagnosing a bug that seems difficult to reduce to a simple reproducible case.
The bug is that a hash element apparently becomes undef. When used as an argument to "split" or "index", it generates a "Use of uninitialized value" error. The mysterious thing about this bug is that it disappears if irrelevant contextual changes are made to the code or the data. For example, if a "warn" statement is inserted, or a "my $dumb = 'dumb';" statement is inserted, before the element is going to be used, then the element does not lose its defined value. If a "use utf8" pragma invocation is added to the existing "use encoding 'utf8'" invocation, the bug disappears. The bug also disappears if the (approximately 20K characters long) text file whose content has been read into the element's value is lengthened or shortened by a few characters. I have reproduced this under Perl 5.8.8 and 5.12.2. It's not obvious to me how to debug something like this, because my usual method of inserting diagnostic "warn" statements into the code is one of the things that stop this bug from appearing. What approach should I try? ˉ -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/