$ perl -e'while (<>) { print "$. $_" }' file 1 foo 2 bar 3 baz 4 qux