perl -pi.bak -e '$count++;s/^/$count. /' file_name