Hi, Chris Charley <[EMAIL PROTECTED]> wrote: > Should be (works correctly): > > while (<>) { > s/^/Line: $. /; > print; > } > > Then the command could be: perl prepend.pl somefile.txt > > somefile.new > which would correctly print to the 'new' file the > somefile.txt file with the line numbers prepended.
I would even suggest perl -i.bak -pe 's/^/Line $.: /' <filenames> This will do the replacement on one or more files whose names oyu give on the command line. Perl will then create backup files with the .bak extension and modify the original files. HTH, Thomas -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]