On Fri, 25 Jan 2002, IT Workflow - Terry Honeyford wrote: > I am reading a line at a time of a windows log file > and want to strip off the CR or LF characters at the end of the line > chomp seems to have a weird effect (returning the cursor to the beginning of > the line!) > I am sure there is a regex to do this (similar to s/\cM//g for MAC line > endings) > but I don't know what characters are at the end of > lines on a windows machine. > Can anyone help?
chomp does exactly what you need. No need to reinvent the wheel. What do you mean by "returning cursor to the beginning of the line"? Are you printing out each line as you read it? Windows uses CR/LF combo (\cM\cJ), BTW, but you should use chomp to safely remove trailing newlines (or more accurately, the value of $/) from the end of each string. See the perldoc on chomp. -- Brett http://www.chapelperilous.net/ ------------------------------------------------------------------------ Do not clog intellect's sluices with bits of knowledge of questionable uses. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]