#! perl -sw use 5.010; use strict; sub bcopy { (my $out, my @in_list)=@_; open (OUTBIN, ">", "$out") || showfailed ("unable to open $out"); binmode(OUTBIN) || showfailed ("unable to set binmode $out"); foreach my $infile (@in_list) { open(INBIN, "<", "$infile")|| showfailed ("unable to open $infile"); binmode(INBIN) || showfailed ("unable to set binmode $infile"); while (read(INBIN, my $buff, 8 * 2**10)) { print OUTBIN $buff; } close(INBIN) || showfailed("unable to close $infile"); print "$infile appended to $out\n"; } close(OUTBIN) || showfailed("unable to close $out"); } my @in = glob shift; my $out = shift; say time; bcopy( $out, @in ); say time;