[EMAIL PROTECTED] wrote:
>
> Good day;
Hello,
> I apologize in advance if this is a very stupid question?
>
> I'm trying to concatenate two files and have the results written to a
> third file.
> Maybe I'm missing something obvious... but in Perldoc for File::Copy I
> read: "The copy function takes two parameters: a file to copy from and
> a file to copy to."
>
> What can I do if I have a second file I want to copy from? (i.e. Like
> DOS copy command: c:\ file1.txt + file2.txt file3.txt will copy the
> contents of file1.txt & file2.txt and put the combined contents into
> file3.txt)
One possible solution:
use File::Copy;
my @from = qw/file1 file2 file3/;
my $to = 'newfile';
open NEW, ">$to" or die "Cannot open $to: $!";
binmode NEW;
for my $file ( @from ) {
copy( $file, \*NEW ) or die "Cannot copy $file: $!";
}
__END__
John
--
use Perl;
program
fulfillment
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]