Andrew Curry wrote:

From: Beginner [mailto:[EMAIL PROTECTED]

On 3 Sep 2007 at 17:26, divya wrote:
A file generated on Windows machine is used on linux m/c while scripting.
A sample line from the file is as shown:

//-------------------------------------------------------^M
File name : project_name^M
.....

Now in the perl script how can I remove ^M without running the command dos2unix.

Note: Trying to split the line whenever ^ detected is not working.

Looking forward for your response.

I use s/\s+$//;

That will just remove all space (\s+$) at the end of the file. \r \n are
different

No they're not. /\s/ matches HT, LF, FF, CR and space. Dermot's is a very
good way of trimming all combinations of CR and LF, as long as you're not
interested in trailing whitespace characters.

Rob

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to