# takes two command line arguments for the source and # destination files, respectively. Then copies the contents # from the source file to the destination file. my $source = $ARGV[0]; my $dest = $ARGV[1]; unless ( $source and $dest ) { print "Source or destination file name missing\n"; } open SOURCE, "< $source" or die "error reading $source - $!"; open DEST, "> $dest" or die "error writing $dest - $!"; while ( <SOURCE> ) { print DEST $_; } close SOURCE; close DEST;
In reply to File I/O #3
by vroom
in thread File Input and Output Exercises
by vroom
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |