reading and writing file

This commit is contained in:
Dan Buch 2011-01-06 23:12:51 -05:00
parent 96160dc452
commit f7bf6d38e6

23
cli/ex03/rwfiles.pl Normal file
View File

@ -0,0 +1,23 @@
#!/usr/bin/env perl
use strict;
use warnings;
use File::Basename;
my $basename = basename($0);
my $USAGE = <<USAGE
Usage: $basename <infile> <outfile>
USAGE
;
open(INFILE, '<', $ARGV[0]) or die "$USAGE\n$!";
open(OUTFILE, '>', $ARGV[1]) or die "$USAGE\n$!";
foreach my $inline (<INFILE>) {
print OUTFILE $inline;
}
1;
__END__