in reply to How do I append more than one files?

You don't need perl for this. In the shell:

copy path\to\file1 + path\to\file2 + path\to\file3 path\to\newfile

Replies are listed 'Best First'.
Re^2: How do I append more than one files?
by ambrus (Abbot) on Jun 16, 2004 at 09:00 UTC

    Strange things can happen if you want to copy binary files this way and forget the /B before the first argument (copy will stop at the first \cd). So:

    copy /b path\to\file1 + path\to\file2 + path\to\file3 path\to\newfile
      Strange things can happen if you want to copy binary files this way and forget the /B before the first argument (copy will stop at the first \cd)
      The solutions given so far will not deal with that, either. In a binary file, you're not at all guaranteed to have a newline. This (untested) code should work in the general case:
      use warnings; use strict; open(my $out, ">", shift(@ARGV) ) or die $!; my $buffer_length = 16_384; while( my $file = shift(@ARGV) ) { open(my $fh, $file) or die $!; while( read($fh, my $buffer, $buffer_length) ) { print $out $buffer or die $!; } close $fh; } close $out or die $!;
      Season to taste.

      thor

Re^2: How do I append more than one files?
by thor (Priest) on Jun 16, 2004 at 12:14 UTC
    The OP knew that there were other ways to do it, but wanted one in perl. One reason that I could see for this is cross-platform portability. If written correctly, the script will be able to run wherever perl is installed.

    thor