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


in reply to Re^2: caller() returns wrong line on multi-line function call
in thread caller() returns wrong line on multi-line function call

I wanted to include in the output any comments in the script adjacent to each function call to generate a regex in the output

Seems a reasonable thing to me.

My approach would be to change the script so those comments are string literal instead of actual comments. Then the text is readily available to your generator script to include in the generated module.