echo "foo bar" |perl -wE'while () { print "$. $_" }' 1 foo 2 bar