in reply to Removing the ^M character, but also removing the newline

I have no idea what you are doing wrong but this works.

#!/usr/local/bin/perl -w
use strict;

my ($str);

$_="what\n is going\non here?\n";

print "Before $_\n";

s/\n//g;

print "After $_\n";

It prints out the following:

Before what 
is going 
on here?

After what is goingon here?

There is no problem. Double check your code. :)

metadoktor

"The doktor is in."

Replies are listed 'Best First'.
Re: You may be making an error.
by c (Hermit) on Dec 29, 2001 at 05:49 UTC
    yes. it looks like i was missing a substitution for \n in my original code. i was only replacing the ^M character, but leaving the new lines in place.

    thanks -c