in reply to Find data point generating Error in Perl code

Could you show some example code? Normally, Perl tracks the last file and line read, and will usually add that information to the warning messages:

use warnings; while(<DATA>) { warn if /X/ } __DATA__ foo bar quzX

Should generate a message like "Warning: something's wrong at - line 2, <DATA> line 3.". Might be interesting to try and find out why that's not happening in your case.

But there are ways that you can do this yourself, for example this node shows how to use a __WARN__ %SIG handler to get custom information into warning messages.

Replies are listed 'Best First'.
Re^2: Find data point generating Error in Perl code
by kgherman (Novice) on Mar 17, 2015 at 18:20 UTC
    I'm not sure I understand how to implement your suggestion: what is DATA that you use in you while loop?

      Quoting perldata:

      The two control characters ^D and ^Z, and the tokens __END__ and __DATA__ may be used to indicate the logical end of the script before the actual end of file. Any following text is ignored.

      Text after __DATA__ may be read via the filehandle PACKNAME::DATA, where PACKNAME is the package that was current when the __DATA__ token was encountered. The filehandle is left open pointing to the line after __DATA__. The program should close DATA when it is done reading from it. (Leaving it open leaks filehandles if the module is reloaded for any reason, so it's a safer practice to close it.) For compatibility with older scripts written before __DATA__ was introduced, __END__ behaves like __DATA__ in the top level script (but not in files loaded with require or do) and leaves the remaining contents of the file accessible via main::DATA.

      See SelfLoader for more description of __DATA__, and an example of its use. Note that you cannot read from the DATA filehandle in a BEGIN block: the BEGIN block is executed as soon as it is seen (during compilation), at which point the corresponding __DATA__ (or __END__) token has not yet been seen.

      Executive summary: it's a special filehandle that allows you to embed data in a Perl script itself, after a __DATA__ token indicating the end of the script proper.

      In the above example, reading from DATA will successively read the lines "foo\n", "bar\n" and "quzX\n", exactly as if you'd opened a file containing them and read from the filehandle you'd got.

      AppleFritter already gave you the docs, just to add to that: DATA doesn't directly relate to your problem, it was just a quick way to show an example of what the warning message might look like. The data can very well reside in a file and the messages would be almost the same.

Re^2: Find data point generating Error in Perl code
by kgherman (Novice) on Mar 17, 2015 at 18:24 UTC
    I have added a schematic of what my code does; the actual code is pretty long so I'm not sure how to make it available for you.