print line number

M

Michael Goerz

Hi,

is there a way to print the line number of the line that is currently
executed in a perl script (similar to the $. variable), so that I can
use it in debugging messages, like this:

[... perl code ...]

$i = 5; print ('The value of $i changed to ', $i, "at line ",
$current_line, "\n") if $DEBUGGING;

[... perl code ...]

Thank,
Michael
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,733
Messages
2,569,440
Members
44,830
Latest member
ZADIva7383

Latest Threads

Top