Omanakuttan wrote: > I am trying to strip off ^Ms from a number of text files. > The following does not seem to work. any suggestions? > > my $filename ; > while ($filename = shift) { > open (INF, $filename) or die "Could not open $filename. $!" ; > my @file = <INF> ; > close INF ; > open (OUT, ">$filename") or die "Could not open $filename. $!" ; > foreach my $line (@file) { > $line =~ s/\015\012// ; ## <===== something wrong with this? > print OUT $line,"\n" ; > } > close OUT ; > } > Thank you. >
I usually do this $/=undef; $filestr = <INF>; $filestr=~s/\r+//g; "$filestr" contains the entire file in a clean string -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]