in reply to how to swap data from files
open RH, "2.txt" or die $!; /^(.+?)\s*$/ and push @new_content, $1 while <RH>; close RH; open RH, "1.txt" or die $!; /^\d+\s*(.+?)\s*$/ and push @old_content, $1 while <RH>; close RH; open WH, ">1.txt" or die $!; for(@new_content){ $count++; print WH "$_ $old_content[--$counter]\n" }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: how to swap data from files
by cpiety (Novice) on Feb 02, 2005 at 22:53 UTC |