in reply to one liner - open file and read
See perlrun about the -n and -p switches:
perl -wnle "$i++;END{print $i}" in.fi [download]
... or
perl -wnle "END{print $.}" in.fi [download]
... or just wc -l in.fi.