use IO::File; my $fh = IO::File->new(); my @files = qw(001.ts 002,ts 003.ts); open $fh , '>' , 'completefile.ts' or die $!; binmode $fh,':raw'; foreach my $f (@files) { open my $read , '<' , $f or die $!; binmode $read,':raw', print {$fh} length $read; while (<$read>) { print {$fh} $_; } close $read or die $!; } close $fh or die $!;