
Perlfaq5 answers the question on how to count the number of lines in a file. file::countlines is a convenient wrapper around that method, with additional options.
more specifically, it counts the number of line breaks rather than lines. on unix systems nearlly all text files end with a newline (by convention), so usually the number of lines and number of line breaks is equal.