programming-examples/perl/File/binmode command sets up a file for access in binary mode with no mapping of carriage returns.pl
2019-11-15 12:59:38 +01:00

22 lines
388 B
Perl

#!/usr/bin/perl -w
# Usage:
# copy1.pl infile outfile
$input = $ARGV[0];
$output = ">" . $ARGV[1];
open(INPUT, $input) or die "Can't open $input due to $!.";
open(OUTPUT, $output) or die "Can't open $output due to $!.";
# Use shorthand for reading file.
while ( <INPUT> ) {
print OUTPUT $_;
}
# Close the files when done.
close (INPUT);
close (OUTPUT);