For Programmers: Free Programming Magazines  


Home > Archive > PERL Programming > June 2004 > Re: chomp pb when using linux









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: chomp pb when using linux
d0x

2004-06-26, 8:55 pm

On Wed, 23 Jun 2004 11:27:01 +0200, Sylvain wrote:

> Hi All,
>
> I have a problem running a script on Linux system (it used to work on HP
> and Solaris) because a return character in Linux is actually (Ctrl M +
> Ctrl J), chomp get rid only of Ctrl J however. My question was the
> following:
> Is there a way ( such as a 'use something;' or defining a special
> variable) to make chomp work correctly?
>
> Regards
>
> Sylvain



I use this to remove the trailling ^M in windows docs.. You can apply the
same / slightly altered formula to your script.

$content =~ s/^M//g;
## Note that is not a regular ^M. to type it correctly type in <CONTROL+V>
then <CONTROL+M>.. on the screen should appear ^M in bold.
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com