programming-examples/perl/File/Deal with r character during file copy.pl

17 lines
349 B
Perl
Raw Normal View History

2019-11-15 12:59:38 +01:00
$infile = $ARGV[0];
$outfile = $ARGV[1];
open (INFILEHANDLE, "<$infile") or die ("Cannot open file.");
open (OUTFILEHANDLE, ">$outfile") or die ("Cannot open file.");
binmode OUTFILEHANDLE;
while (defined($line = <INFILEHANDLE>)) {
$line =~ s/\r//g;
print OUTFILEHANDLE $line;
}
close INFILEHANDLE;
close OUTFILEHANDLE;