in reply to cat -ing Multiple files with Perl

Since i wrote it, i might as well post it, even if the answers were more than adequate.
use strict; my @files = qw(file1.txt file2.txt file3.txt); my $merge = (@ARGV) ? shift : 'merged.txt'; open (BUFF, '>>', $merge) or die "Unable to open: '$merge'"; while (@files) { local $_ = shift @files; my $fileData = do { local (*ARGV, $/) = [$merge] and <> }; print BUFF $fileData; } close (BUFF);