use strict; use warnings; #OPEN FILE A.txt FOR APPENDING (CHECK FOR FAILURES) open ( FOO, ">>", 'A.txt' ) or die "Could not open file A.txt: $!"; #OPEN FILE B.txt for READING (CHECK FOR FAILURES) open ( BAR, "<", 'B.txt' ) or die "Could not open file B.txt: $!"; #READ EACH LINE OF FILE B.txt (BAR) and add it to FILE A.txt (FOO) while ( my $line = ) { print FOO $line; }