1 234 $ perl -e'my $i="000"; while (<>) { print ++$i, " $_" }' file 001 foo 002 bar 003 baz 004 qux