in reply to Want to know Line number of the input file

Hello,

line number of the current file handle is stored in the special variable $.

You may note that $. is reset only by an explicit close of the filehandle, so if the same filehandle is reopened $. continue grows between files. This can be avoided with close ARGV if eof that is very useful for oneliners.

perl -lne "print qq($.)" two_lines.log 13_lines.log 1 2 3 #<--here starts second file 4 5 6 7 8 9 10 11 12 13 14 15 perl -lne "print qq($.); close ARGV if eof" two_lines.log 13_lines.log 1 2 1 #<--here starts second file 2 3 4 5 6 7 8 9 10 11 12 13

L*

There are no rules, there are no thumbs..
Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.