in reply to Line number in a file

if $/(input record separator) is '\n',

use $. which is used to get the current line number.

for ur problem, use $` and count the number of \n which yields the line number.(But using $` makes program run slow)

cheers