in reply to update every line of a text file (was: file)
Nota bene: it is better to entitle your questions with something more descriptive than "file", say, "Editing a file in place", or "Updating a flat file database". -Markopen OLD, "<old.txt" or die "Could not open old.txt: $!"; open NEW, ">new.txt" or die "Could not open new.txt: $!"; my $i = 0; while (<OLD>) { chomp; $_ .= $table[ $i++ ]; print NEW "$_\n"; } close OLD; close NEW;
|
|---|