$ cat tmp.txt hello world hello linux hello perl
$ perl -n -e 'print "$.\. $_"' tmp.txt 1. hello world 2. hello linux 3. hello perl