Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

You may be making an error.

by metadoktor (Hermit)
on Dec 29, 2001 at 05:32 UTC ( [id://135047]=note: print w/replies, xml ) Need Help??


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

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://135047]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (2)
As of 2024-04-24 17:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found