programming-examples/perl/File/File copying.pl

18 lines
371 B
Perl
Raw Normal View History

2019-11-15 12:59:38 +01:00
#!/usr/bin/perl -w
use strict;
my $source = shift @ARGV;
my $destination = shift @ARGV;
open(IN, '<', $source) or die "Can't read source file $source: $!\n";
open(OUT, '>', $destination) or die "Can't write on to file $destination: $!\n";
print "Copying $source to $destination\n";
while (<IN>) {
print OUT $_;
}
close IN;
close OUT;