Hi
Use the ">>" file operator i.e.:

open (OUTPUT, ">>filename.txt") or die;
$dir = "##enter the directory path here";

opendir (DIR, $dir) or die;             ## opens the directory you 
described in the line above
@files = readdir (DIR);         ## puts the contents of the directory in an 
array

foreach (@files) {

if ($_ =~ m/.txt/i){                    ## matches all files with a .txt 
extension - use whatever you need to get the file(s) for input

$INPUT = "$dir\\$_.txt";        ## this (\\) is the directory/file 
delimiter for windows- unix would be different
open (INPUT)  or die;

while ($line = <INPUT>) {
print OUTPUT $line;
}## END WHILE

} ## END FOR EACH

} ## END IF

I think this will work (not sure...) but I hope this helps.
Carl

At 02:30 PM 6/1/2001 -0500, Nichole Bialczyk wrote:
>i understand how to open and create files, but let's say that i want to
>open several files and insert them all into one large file. how would i
>do that?
>
>thanks, nichole

Reply via email to