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

... or

perl -wnle "END{print $.}" in.fi

... or just wc -l in.fi.