No such thing as a small change | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
Hallo Monks, I am trying to find a way to dynamically determine the current line being executed in my script. I have a batch script which I accumulate a progress report or log whilst it is running and then output the log to a file on completion. I wish to add the current line number being executed in the script to each instance in the report The following describes a snippet of code to demonstrate my requirement. I have annotated the code with line numbers for demonstration purposes
The following demonstrates the hard coded method at line 31, but if there is a way of determining this dynamically then this would reduce the need to have to manually update the hard coded value whenever the script is modified. I envisage substituting line 31 as follows: push (@log, "Read $file not successfull" . &function_returning_current_line) ; or anything similar; i.e. Get a near enough line number before the call to push etc Any help would be greatly appreciated Best regards Lucas Redding AKA Bearslumber In reply to How to determine current line executing in Script by bearslumber
|
|