in reply to How to concatenate the contents of two files?
HTHuse 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 = <BAR> ) { print FOO $line; }
-enlil
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: How can I concatenate two files?
by terra incognita (Pilgrim) on Sep 02, 2004 at 20:33 UTC | |
by ikegami (Patriarch) on Sep 02, 2004 at 20:38 UTC | |
|
Re^2: How can I concatenate two files?
by ikegami (Patriarch) on Apr 12, 2005 at 21:20 UTC |