--- Nichole Bialczyk <[EMAIL PROTECTED]> 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?
At the simplest level, let's assume you have the filenames in an array
named @files, and want them stacked into $out.
open OUT, ">>$out" or die "$out:$!";
for my $thisfile (@files) {
open IN, $thisfile or die "$thisfile:$!";
print OUT <IN>;
}
close OUT;
close IN;
re-opening the IN filehandle is okay -- it does an implicit close.
print puts <IN> into a list context, so it'll return all the lines in
the file.
This assumes it's a text file, though. =o)
__________________________________________________
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail - only $35
a year! http://personal.mail.yahoo.com/