As an alternative without the problem of spaces (POSIX):

    $ sed -n '$=' ~/myfile.txt

Captured in a variable:

    $ nl=$(sed -n '$=' ~/myfile.txt)
    $ echo "1-$nl-"
    1-100-

Note that sed counts the last line even if it doesn't end in a newñime character (as it should in a properly formated text file).


---
Another alternative (not that I recomend using it):

    $ nl=$(cat ~/myfile.txt | tr -dc '\n' | tr '\n' 'x')
    $ echo "1-${#nl}"
    1-100