#!/usr/bin/perl -w
# The intent of this program is to remove a trailing
# line feed character (^M) from a text line.
$input_file = $ARGV[0];
$output_file = $ARGV[1];
open (INFILEHANDLE, "<$input_file")
or die "Cannot open file, $input_file\n";
open (OUTFILEHANDLE, ">$output_file")
or die "Cannot open file, $output_file\n";
binmode OUTFILEHANDLE;
while (defined($line = <INFILEHANDLE>)) {
$line =~ s/\r//g;
printf OUTFILEHANDLE ("%s"), $line;
}
close INFILEHANDLE;
close OUTFILEHANDLE;
----- Original Message -----
From: "Moon, John" <[EMAIL PROTECTED]>
To: "beginners perl" <beginners@perl.org>
Sent: Thursday, December 07, 2006 5:19 PM
Subject: Line ending with Gary"^M on UNIX
Can someone please give me the octal values or a method of removing ^M
from the end of an input line, if present?
Thank you in advance
jwm
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>