in reply to I need to append to text file
This is not tested so I may have screwed something up but the idea should work.use strict; my $file1 = shift(@ARGV); my $file2 = shift(@ARGV); # open the first file, slurp the contents into # $file1_contents open(FILE1, "<", $file1) or die "Whoops!"; my $file1_contents = <FILE1>; close(FILE1); # open the second file in append mode, print # the contents from file1 into file2 open(FILE2, ">>", $file2) or die "Whoops!"; print FILE2 $file1_contents; close(FILE2);
|
|---|